No longer maintained. ZPT Metals is retired. Version 1.2.1 (January 2023) is the final release: no further updates, fixes or support will be published, and compatibility with current WordPress, WooCommerce and metals-api.com versions is not verified. The documentation stays here for existing installations.

ZPT Metals

v1.2.1 Retired

Display live and historical precious-metal rates (gold, silver, platinum and 36 more) with shortcodes, and auto-price WooCommerce products from them.

WordPress 5.0+metals-api.com API key Updated 9 Jan 2023

Shortcode

Use [zpt-metals] in any post, page or widget that accepts shortcodes. Combine the attributes below as needed.

Attribute Required Description
type Yes Which metal to show, for example gold, silver, platinum, palladium, rhodium or ruthenium. Any metal listed on the Overview tab is accepted.
base No Currency for the rate, such as USD or GBP. Defaults to the currency chosen in the plugin settings.
price-round No Number of digits after the decimal point. Any integer.
date No Show the rate for a specific day instead of the latest. Format YYYY-MM-DD.
date-format No How the rate's date is printed, using PHP date format characters, for example Y-m-d or m-d-Y.

Examples#

Latest gold rate in the default currency:

[zpt-metals type="gold"]

Silver in British pounds, rounded to two decimals:

[zpt-metals type="silver" base="GBP" price-round="2"]

Platinum on a given day, with the date shown as day-month-year:

[zpt-metals type="platinum" date="2022-03-01" date-format="d-m-Y"]

WooCommerce auto pricing#

Edit a product, open the Auto pricing tab under Product data, enable it and choose a metal. The product price then follows that metal's rate at each scheduled refresh.