Skip to main content

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:

  1. NFusionService::getPrices() loads all on-sale products from the products table (see Product::getOnSaleProducts()).
  2. For each product, if markup_sale_price is set and > 0, a sale_ask price is calculated:
sale_ask = base_ask + (markup_sale_price × weight_in_ounces)
  1. The sale_ask, sale_starts_at, and sale_ends_at fields are included in the price data passed to each sync provider.
  2. WooCommerce sync writes _sale_price, _sale_price_dates_from, and _sale_price_dates_to meta.

Managing Sale Prices

Sale prices are managed via the Products resource in the Filament admin panel.

FieldDescription
skuProduct SKU (must match nFusion and WooCommerce)
markup_sale_pricePer-ounce markup reduction (a lower number = cheaper sale price)
sale_starts_atWhen the WooCommerce sale should activate
sale_ends_atWhen 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_price is set to sale_ask
  • _sale_price_dates_from is set to sale_starts_at (Unix timestamp)
  • _sale_price_dates_to is set to sale_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.