Sale Price Overlays
The Middleware Platform supports a sale-price overlay feature that lets you define temporary discounted prices per SKU. These are applied on top of the live nFusion spot price before syncing to WooCommerce or Algolia.
How It Works
When a tenant has supports_markup_sale_prices = true:
NFusionService::getPrices()loads all on-sale products from theproductstable (seeProduct::getOnSaleProducts()).- For each product, if
markup_sale_priceis set and> 0, asale_askprice is calculated:
sale_ask = base_ask + (markup_sale_price × weight_in_ounces)
- The
sale_ask,sale_starts_at, andsale_ends_atfields are included in the price data passed to each sync provider. - WooCommerce sync writes
_sale_price,_sale_price_dates_from, and_sale_price_dates_tometa.
Managing Sale Prices
Sale prices are managed via the Products resource in the Filament admin panel.
| Field | Description |
|---|---|
sku | Product SKU (must match nFusion and WooCommerce) |
markup_sale_price | Per-ounce markup reduction (a lower number = cheaper sale price) |
sale_starts_at | When the WooCommerce sale should activate |
sale_ends_at | When the WooCommerce sale should deactivate |
Sale Price Formula
base_ask = nFusion BaseAsk (spot price + base markup, before retail tier markups)
weight = product weight in troy ounces
markup_sale = markup_sale_price from products table
sale_ask = base_ask + (markup_sale × weight)
If markup_sale is lower than the standard markup, the sale price will be lower than the regular price.
WooCommerce Sync Integration
When syncing to WooCommerce:
_sale_priceis set tosale_ask_sale_price_dates_fromis set tosale_starts_at(Unix timestamp)_sale_price_dates_tois set tosale_ends_at(Unix timestamp)
WooCommerce uses these dates to automatically activate and deactivate the sale price on the storefront.
Populating the Products Table
Products are inserted or updated in the products table by the WooCommerce product-update webhook. When WooCommerce sends a product.updated event, WooCommerceProductUpdateController creates or updates a Product record.
See WooCommerce Product Update Webhook → for details.