NFusion Integration
NFusion Solutions is the precious metals data and catalog platform that Scottsdale Mint uses as its pricing data source, product catalog reference, and order fulfillment reporting destination.
Overviewโ
NFusion serves two primary roles:
- Pricing Source โ Live spot prices, premium rates, and product pricing data flow from NFusion (via a Laravel middleware) to the WooCommerce product catalog.
- Order Destination โ Completed WooCommerce orders are exported to NFusion for fulfillment reporting and catalog inventory management.
Environment Variablesโ
| Variable | Description |
|---|---|
NFUSION_API_KEY | NFusion order/data API key |
NFUSION_PRODUCT_API_KEY | NFusion product catalog API key |
NFUSION_PRODUCT_CATALOG_BASE_URL | NFusion catalog base URL (e.g., https://scottsdalemint2.nfusioncatalog.com) |
Pricing Data Flowโ
The Laravel middleware (external to this repository) is responsible for:
- Authenticating with NFusion's pricing API
- Fetching current spot prices for gold, silver, platinum, palladium
- Fetching per-SKU premium rates and product pricing
- Transforming the data into the format expected by the WP REST API
- Calling
POST /wp-json/suma/v1/product/update-pricesevery minute
The WordPress side (this codebase) handles:
- Receiving the price payload
- Updating WooCommerce product prices via
\Suma\Product\PriceUpdater - Cache invalidation
See Price Updates for the update endpoint details.
Order Export to NFusionโ
When an order is completed in WooCommerce, selected order data is pushed to NFusion for:
- Fulfillment reporting
- Catalog inventory synchronization
- Sales analytics
The export process is triggered on the woocommerce_order_status_completed action.
Data exported:
- Order ID, order number
- Order date and time
- Customer information (name, address)
- Line items (SKU, product name, quantity, price, metal type, weight)
- Payment method
- Shipping method and tracking
Product Catalog Importโ
When new products are added to the Scottsdale Mint catalog, the NFusion import tools in tools/nfusion-import/ help prepare the data:
retail-import.phpโ
Maps WooCommerce product export data to NFusion's product import format:
| WooCommerce Field | NFusion Field |
|---|---|
sku | Item Code |
name | Product Name |
_metal_type | Metal Type (mapped: Gold โ G, Silver โ S, Platinum โ P) |
_metal_weight_troy_oz | Weight (troy oz) |
| Product category | Product Family |
Output: nfusion-retail-import.csv โ ready for import into the NFusion catalog portal.
retail-tiers-import.phpโ
Converts WooCommerce volume pricing tiers to NFusion's price tier import format:
Input: WooCommerce product's _volume_pricing JSON meta
Output: nfusion-price-tiers-import.csv
Live Price Chart Widgetโ
The nfusion/live-price-chart/ directory contains the NFusion spot price chart widget โ a JavaScript widget that displays live precious metals prices.
Setup:
cd nfusion/live-price-chart
npm install
npm run dev # Development
npm run production # Production build
The widget is embedded in Elementor pages via:
- A custom Elementor widget that renders the NFusion embed code
- OR an Elementor HTML widget with the NFusion JavaScript embed snippet
Configuration: The widget ID and settings are managed in widgetcdn.nfusionsolutions.com/ and configured at the NFusion account level.
NFusion API Rate Limitsโ
The Laravel pricing middleware handles NFusion's API rate limits. The WordPress side should not make direct calls to NFusion APIs. All NFusion data arrives via the price update REST endpoint.
Troubleshootingโ
| Issue | Check |
|---|---|
| Prices not updating | Check Laravel middleware is running; check /wp-json/suma/v1/product/update-prices returns 200 |
| Wrong prices on staging | Staging has separate test NFusion catalog โ verify NFUSION_PRODUCT_CATALOG_BASE_URL env var |
| Order not appearing in NFusion | Check the order export hook; verify NFUSION_API_KEY is valid; check Wonolog error logs |
| Live chart widget not loading | Check browser console for NFusion CDN errors; widget config is account-level |