=== Live Gold and Silver Price Sync for WooCommerce ===
Contributors: stefanomartella96, freemius
Tags: woocommerce, gold, silver, dynamic pricing, bullion
Requires at least: 5.0
Requires PHP: 7.4
Tested up to: 7.0
Stable tag: 1.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Automatically syncs WooCommerce product prices with real-time gold (XAU) and silver (XAG) market values, based on product weight and purity.

== Description ==

Live Gold and Silver Price Sync for WooCommerce automatically calculates and updates WooCommerce product prices based on real-time precious metal market values. Supports gold and silver with automatic detection and per-product configuration.

Prices can be calculated in euro, US dollar, pound sterling, Swiss franc, yen and the other major currencies: pick the one your shop sells in and the plugin converts the market quotes for you.

Full documentation and setup guides: https://dynamic-bullion.com/docs

= Features =
* Dynamic pricing automatically updated based on real metal market values
* Multi-currency: price in EUR, USD, GBP, CHF, JPY, CAD, AUD or NZD
* Configurable update interval: hourly, twice daily or daily
* On-demand manual price refresh from the dashboard
* Multi-metal support: gold (XAU) and silver (XAG)
* Automatic price calculation based on metal weight and purity
* Configurable profit margin and fixed markup per product
* Full WooCommerce integration (simple and variable products), no complex configuration needed

= Premium Features =
* Faster update intervals (every 10 or 30 minutes), backed by a premium price feed refreshed every 10 minutes server-side (the free feed is refreshed hourly)
* Cart price lock: when a customer adds a product, the price stays fixed for a time period you choose, with a visible countdown timer
* Automatic cart clearing: when the timer expires the cart is emptied and the customer can re-add at the new price
* Priority email support

The premium features are not included in this plugin: they are delivered as a separate premium version available through Freemius.

== External Services ==

This plugin connects to external services to retrieve real-time precious metal prices. No personal data of your visitors is ever sent to these services.

= Metal Price API (https://crm-dynamic-bullion.it) =
The plugin fetches current gold (XAU) and silver (XAG) market prices from the price service hosted at https://crm-dynamic-bullion.it, operated by the plugin author. Requests are sent only when prices need updating (based on your configured update frequency). Premium installations also send their Freemius license key and site ID for license verification. No customer or visitor data is transmitted. Privacy & data handling: https://crm-dynamic-bullion.it/privacy

= ExchangeRate-API (currency conversion) =
Metal quotes are denominated in USD, so the plugin queries https://www.exchangerate-api.com (public v4 endpoint) to convert them into your pricing currency. Rates are cached for an hour, and the request is skipped entirely when you price in US dollars. Only a standard HTTP request is made; no site or user data is sent. Terms: https://www.exchangerate-api.com/terms

= Freemius =
Licensing, plugin updates and optional usage tracking (opt-in) are handled by Freemius. See https://freemius.com/privacy/ for details. Data is only collected after explicit user opt-in.

== Installation ==

1. Upload the 'gold-silver-price-sync' folder to '/wp-content/plugins/'
2. Activate the plugin from the 'Plugins' page in WordPress
3. Go to WooCommerce > Gold & Silver Price Sync to configure settings

== Usage ==

1. Ensure your WooCommerce products have the correct weight configured
2. Set the desired profit margin in the plugin settings
3. Select the metal type (gold or silver) for each product
4. Set the purity level if applicable
5. Prices will be updated automatically based on real-time market data

== Key Features ==

= Multi-Metal Dynamic Pricing =
Prices are automatically updated based on current gold and silver market values, at the interval you choose.

= Multi-Currency =
Choose the currency prices are calculated in: EUR, USD, GBP, CHF, JPY, CAD, AUD or NZD. Market quotes are converted automatically, and amounts are displayed using your WooCommerce currency symbol and separators. Keep the setting aligned with your WooCommerce currency: the plugin warns you on the settings page if the two differ.

= Automatic Metal Detection =
Products are automatically detected as metal products based on categories, tags, or product names containing keywords like "gold", "oro", "silver", or "argento".

= Purity Support =
Gold: 24k, 22k, 18k, 14k, 10k
Silver: .999, .925, .900, .800

= Cart Price Locking (Premium) =
When a customer adds a product to the cart, the price is locked for the configured duration. A visible timer shows the remaining time before products are removed from the cart. This feature is part of the separate premium version.

== Frequently Asked Questions ==

= Where can I find the documentation? =
The full documentation, with setup and configuration guides, is available at https://dynamic-bullion.com/docs

= Where do the metal prices come from? =
Prices are retrieved in real time from the plugin's price service, which sources official gold (XAU) and silver (XAG) market quotations. See the "External Services" section for details.

= Can I sell in a currency other than euro? =
Yes. Under WooCommerce > Gold & Silver Price Sync, set "Pricing currency" to the currency your shop sells in: EUR, USD, GBP, CHF, JPY, CAD, AUD or NZD. Market quotes are converted for you, and changing the setting refreshes every price straight away. The setting should always match your WooCommerce currency, because WooCommerce stores product prices as plain numbers with no currency attached; the plugin shows a warning if the two ever diverge.

= Do I need WooCommerce? =
Yes. This plugin is a WooCommerce extension and requires an active WooCommerce installation to manage product prices.

= How is the final price calculated? =
For each product the price is: weight (in grams) x price per gram x purity factor x (1 + profit margin %) + fixed markup. You set the profit margin and, optionally, a fixed markup per product.

= Which products get dynamic pricing? =
Products are detected automatically based on categories, tags or names containing keywords like "gold", "oro", "silver" or "argento". You can also set the metal type, weight and purity per product.

= How often are prices updated? =
You choose the interval: hourly, twice daily or daily. You can also trigger a manual refresh at any time. The premium version adds 10 and 30 minute intervals, backed by a price feed refreshed every 10 minutes server-side (the free feed is refreshed hourly).

= What is cart price locking? (Premium) =
When a customer adds a product to the cart, the price is locked for a duration you choose. A visible countdown shows the remaining time; when it expires the cart is cleared so the customer re-adds at the current price.

= Does it slow down my store? =
No. Prices are cached and remote requests run in the background via cron or the admin area, never on storefront page loads.

== Screenshots ==

1. Per-product settings: in each product's settings panel you choose the metal type (gold or silver), the weight in grams, an optional fixed markup and the purity. The calculated dynamic price automatically replaces the product's list price on the storefront.
2. Purity factors: in the plugin settings you define the multiplier applied to each purity level for gold (24K to 10K) and silver (.999 to .800), so prices reflect the real fineness of each item. The global profit margin is configured here as well.

== Changelog ==

= 1.1.0 =
* New: pricing currency setting supporting EUR, USD, GBP, CHF, JPY, CAD, AUD and NZD
* New: amounts throughout the plugin now follow the WooCommerce currency symbol, separators and symbol position instead of a fixed euro format
* New: warning on the settings page when the pricing currency differs from the WooCommerce store currency
* Changing the pricing currency refreshes all metal prices immediately
* Exchange rates are cached for an hour and fall back to the last known good rate, and a price is never written when no rate is available
* Existing installations keep pricing in euro; no action needed after updating

= 1.0.0 =
* Initial public release
* Dynamic WooCommerce pricing based on real-time gold (XAU) and silver (XAG) market values
* Configurable update interval (hourly, twice daily or daily) and on-demand manual refresh
* Automatic metal detection and per-product weight and purity settings
* Configurable profit margin and fixed markup per product
* Full WooCommerce integration (simple and variable products)
* Premium (separate version): cart price lock with a visible countdown timer and automatic cart clearing
