Skip to main content
Deprecated Architecture

This documentation describes the legacy dealer site pricing model. Pricing calculation has been moved to the SDM Middleware using nFusion's data. The dealer site now imports pre-calculated prices from the middleware and stores them in product meta and Algolia. The frontend display logic (volume pricing, catalog overrides) remains unchanged. See Pricing Storage & Display Reference for the current architecture.

Precious Metal Pricing

Frontend Display Only

The MetalPricing class (inc/class-metal-pricing.php) now handles frontend display only — retrieving and formatting pricing data that was calculated and imported by the Middleware Platform. Actual price calculations are performed in the SDM Middleware using nFusion's tier and spot data.


Spot Price Storage (Legacy)

Deprecated

Spot prices are no longer used for calculation on the dealer site. Prices are calculated by the Middleware and imported as final values. These WordPress options are retained for reference/reporting only. Do not modify them manually.

Historically, spot prices were stored as WordPress options, updated by external syncs:

Option KeyDescription
spot_price_goldGold spot price (USD/oz) — not used for pricing
spot_price_silverSilver spot price (USD/oz) — not used for pricing
spot_price_platinumPlatinum spot price (USD/oz) — not used for pricing
spot_price_modifier_goldHistorical modifier (not used)
spot_price_modifier_silverHistorical modifier (not used)
spot_price_modifier_platinumHistorical modifier (not used)
markup_modifier_goldHistorical modifier (not used)
markup_modifier_silverHistorical modifier (not used)
markup_modifier_platinumHistorical modifier (not used)

Markup Modes (Calculation Legacy — Now in Middleware)

Deprecated

Markup calculation no longer happens on the dealer site. The SDM Middleware calculates final prices using nFusion data and these modes, then imports the results. All products use each_fixed as their markup_mode since the prices should be presented as-is. This section is kept for reference only.

ModeFormula (Executed in Middleware)
each_fixedfinal_price = spot_price + fixed_markup_per_unit
weight_percentfinal_price = spot_price + (spot_price × markup_rate) per ounce × weight

Public REST API

The GET /suma/v1/spot-prices endpoint (registered by Endpoints\Pricing) exposes current prices publicly:

[
{
"name": "gold",
"price": "1927.40",
"change": "+0.32%",
"changeType": "increase"
},
{
"name": "silver",
"price": "23.18",
"change": "-0.10%",
"changeType": "decrease"
}
]

This endpoint powers the Price Ticker Elementor widget shown site-wide.


Price Import Endpoint (Current Architecture)

Current Implementation

The POST /suma/v1/prices endpoint is the current mechanism for receiving pre-calculated prices from the Middleware Platform.

The POST /suma/v1/prices endpoint (registered by Endpoints\Pricing) receives calculated price data from the Middleware Platform's HTTP Sync Target and writes it to WooCommerce product meta. This endpoint imports:

  • _price — Final calculated ask price
  • _regular_price — Regular price for WooCommerce
  • _markup_rate — Markup used in calculation (for reference/cart display)
  • _markup_mode — Markup mode used in calculation
  • _volume_pricing — Volume tier breaks with calculated ask prices
  • _metal_weight — Metal weight for the product

Compact Payload Field Map

The middleware sends prices using this compact field map:

  • wa → base ask / regular price (final calculated price from middleware)
  • mr → markup rate (used during middleware calculation)
  • mm → markup mode (e.g., weight_percent, each_fixed)
  • t → tier pricing JSON (volume tiers with calculated ask prices)
  • w → metal weight

Authentication

Authentication uses a shared token defined as PRICES_API_TOKEN in wp-config.php.