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:
| Component | Description | Stored In |
|---|---|---|
| Spot Price | Live market price for the metal (USD per troy oz) | Redis transient (suma_pricing_cache) |
| Metal Weight | Troy ounce content of the specific product | _metal_weight_troy_oz product meta |
| Purity | Metal fineness fraction | _metal_purity product meta |
| Premium | Markup over spot (% or fixed $) | _premium_type, _premium_value product meta |
| Volume Discount | Reduction for larger quantities | _volume_pricing product meta (JSON) |
| Customer Tier | Dealer/wholesale discount for certain user roles | User 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โ
| Metal | Typical Units Sold | Purity Examples |
|---|---|---|
| Gold | Troy ounce, fractional oz, gram | .999, .9999, .9167 (22K) |
| Silver | Troy ounce, 5 oz, 10 oz, kilo | .999, .9999 |
| Platinum | Troy ounce | .9995 |
| Palladium | Troy 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:
- Manual sale: Admin sets a
sale_pricein the WooCommerce product editor - Scheduled sale: Admin sets
date_on_sale_fromanddate_on_sale_to - Automatic via REST API:
POST /wp-json/suma/v1/product/start-salesandend-expired-salesendpoints 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.).