=== Juniustech Gold Price Calculator ===
Contributors: juniustech
Tags: gold, gold price, calculator, precious metals, price calculator
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Calculates the value of gold by weight and purity using live spot prices.

== Description ==

Juniustech Gold Price Calculator fetches live gold prices, converts them to CHF, and displays an interactive karat price table on any page.

**Features:**

* Hourly automatic price updates (WordPress cron), with a one-hour cache
* 9 gold alloys (999 to 333)
* Additional kg rows for silver-plated items and tin (CHF/kg editable in settings)
* Combined TOTAL (CHF) across grams and kilograms
* Configurable surcharge per gram (default: 0.50 CHF)
* Shortcode: `[gold_price_calculator]`
* Shows the last known price if the API is temporarily unavailable
* Inquiry form that emails the gram/karat and kg breakdown
* Responsive table design

== External services ==

This plugin connects to external APIs to retrieve live gold spot prices and
currency exchange rates. This is required because the calculator shows
up-to-date values instead of static prices.

Requests run on the server with `wp_remote_get`. No personal data, no visitor
information and no site content is transmitted by this plugin.

1. Gold API (https://api.gold-api.com/price/XAU) — gold price in USD. Used when
   no custom JSON URL is set. Terms: https://gold-api.com/  Privacy: the request
   contains only the metal symbol path (XAU).

2. Frankfurter (https://api.frankfurter.dev/) — USD to CHF conversion. Used to
   convert the gold USD price to CHF. Terms: https://www.frankfurter.dev/
   The request contains only currency codes (USD, CHF).

3. Alpha Vantage (https://www.alphavantage.co/query) — optional fallback when
   the sources above fail, or when the site owner has entered an API key.
   The request contains lookup parameters (metal/currency codes) and the site
   owner's own API key. Terms: https://www.alphavantage.co/terms_of_service/
   Privacy: https://www.alphavantage.co/privacy/

4. Optional custom JSON URL (settings) — if the site owner enters a URL, that
   host is requested first. Only the URL they configured is contacted.

A request is sent when cached price data expires and a page containing the
calculator is loaded, when WordPress cron runs the hourly update, and when an
administrator saves settings or clicks Refresh now.

== Installation ==

1. Upload the `juniustech-gold-price-calculator` folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu
3. Go to **Settings → Gold Price Calculator** and click **Refresh now** (an API key is optional)
4. Optionally enter an Alpha Vantage API key or a custom gold JSON URL
5. Add `[gold_price_calculator]` to any page or post

== Frequently Asked Questions ==

= Where do I get an API key? =

An API key is optional. Free gold and FX sources are used first.

If you still want Alpha Vantage as a fallback: https://www.alphavantage.co/support/#api-key

The key is entered in the plugin settings. No API key is bundled with the plugin.

= How often is the price updated? =

Prices are cached for at least one hour (WordPress transient) and refreshed hourly via WordPress cron. Use **Refresh now** in settings for a manual update.

= What shortcode do I use? =

`[gold_price_calculator]`

= Does this plugin send visitor data to Alpha Vantage? =

No. Requests run on the server with `wp_remote_get`. Visitor data is not sent. Alpha Vantage is only contacted as a fallback, and then only with lookup parameters and the site owner's API key.

== Changelog ==

= 1.2.2 =
* Fixed kg prices (Versilbert, Messer, ZINN) can be changed in Settings → Gold Price Calculator

= 1.2.1 =
* Restored a working price fetch chain: optional JSON URL, free gold + CHF conversion, then Alpha Vantage
* Alpha Vantage API key is optional
* Admin shows the last fetch error instead of a generic "check the API key" message

= 1.2.0 =
* Added fixed CHF/kg rows in the same gold table (Versilbert 90/100, Versilberte Messer, ZINN)
* Inquiry email lists quantity with g or kg
* Improved mobile table layout

= 1.1.0 =
* WordPress.org release as a standalone juniustech product
* Removed third-party branding and the Frankfurter dependency
* Alpha Vantage is the sole external service; API key is supplied in settings
* Price data is cached with a one-hour transient
