Skip to main content

Precious Metals Pricing Overview

Scottsdale Mint sells physical precious metals (coins and bars) whose prices are derived from live spot market prices. This page describes the end-to-end pricing data flow from the NFusion pricing source through to the WooCommerce product catalog.


Pricing Data Flowโ€‹

NFusion Solutions API (spot prices, premium data)
โ”‚
โ–ผ
Laravel Pricing Middleware (external โ€” not in this repo)
- Fetches spot prices from NFusion
- Applies site-specific premium rules
- Calculates final prices per SKU
- Authenticates to WordPress REST API
โ”‚
โ”‚ POST every minute
โ–ผ
POST /wp-json/suma/v1/product/update-prices
(suma-elementor theme, inc/endpoints/class-pricing.php)
โ”‚
โ–ผ
\Suma\Product\PriceUpdater::update_batch()
- Looks up WC product by SKU
- Writes new price to _price and _regular_price post meta
- Flushes Redis object cache for those product IDs
โ”‚
โ–ผ
CloudFront cache invalidation
- Product page HTML cache invalidated for updated products
โ”‚
โ–ผ
Customer sees up-to-date prices on product pages

Price Componentsโ€‹

Every precious metals product price is composed of:

ComponentDescriptionStored In
Spot PriceLive market price for the metal (USD per troy oz)Redis transient (suma_pricing_cache)
Metal WeightTroy ounce content of the specific product_metal_weight_troy_oz product meta
PurityMetal fineness fraction_metal_purity product meta
PremiumMarkup over spot (% or fixed $)_premium_type, _premium_value product meta
Volume DiscountReduction for larger quantities_volume_pricing product meta (JSON)
Customer TierDealer/wholesale discount for certain user rolesUser role + ACF user meta

Formulaโ€‹

Metal Value = Spot Price ร— Metal Weight (oz) ร— Purity
Final Price = Metal Value + Premium
(less volume discount if applicable)

Supported Metalsโ€‹

MetalTypical Units SoldPurity Examples
GoldTroy ounce, fractional oz, gram.999, .9999, .9167 (22K)
SilverTroy ounce, 5 oz, 10 oz, kilo.999, .9999
PlatinumTroy ounce.9995
PalladiumTroy ounce.9995

Price Update Frequencyโ€‹

  • Frequency: Every 1 minute (driven by the Laravel pricing middleware)
  • Trigger: External cron on the Laravel side calls the WP REST API
  • Volume: Typically 100โ€“500 products updated per batch
  • Timeout: Lambda timeout is 120 seconds; price updates should complete in < 10 seconds

Live Spot Price Displayโ€‹

In addition to WooCommerce product prices being updated every minute, the site also displays a live spot price chart widget (from NFusion) that updates even more frequently:

  • Widget source: nfusion/live-price-chart/
  • Renders an embeddable JavaScript widget from NFusion's CDN
  • Not cached by WordPress โ€” fetches directly from NFusion CDN
  • Configurable via Elementor widget or shortcode

Sale Pricingโ€‹

Products can be put on sale in two ways:

  1. Manual sale: Admin sets a sale_price in the WooCommerce product editor
  2. Scheduled sale: Admin sets date_on_sale_from and date_on_sale_to
  3. Automatic via REST API: POST /wp-json/suma/v1/product/start-sales and end-expired-sales endpoints manage scheduled sales

The Product\PriceUpdater class validates that a sale price is never negative after spot price changes:

// class-woocommerce.php
add_filter( 'woocommerce_product_is_on_sale', [ $this, 'validate_sale_price' ], 10, 2 );

Pricing for Dealers / Wholesaleโ€‹

Customer accounts with dealer-tier roles receive different premium rates. The Product\Pricing class checks the current user's role and tier via \Suma\Theme\User before calculating the final price.

This is transparent to the customer โ€” they see their tier-specific pricing automatically when logged in.


Historical Pricing Dataโ€‹

The \Suma\Trends class and the /wp-json/suma/v1/trends REST endpoint provide historical spot price data for:

  • Front-end price charts
  • NFusion live chart widget data
  • Admin analytics reports

Data is cached in Redis with time-based expiration appropriate to the requested period (1 day, 1 week, 1 month, etc.).