# ZPT Metals: Shortcode

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

Page: https://developers.zactonz.com/wordpress/plugins/zpt-metals/shortcode/

Complete documentation for this product: https://developers.zactonz.com/wordpress/plugins/zpt-metals.md

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:

```text
[zpt-metals type="gold"]
```

Silver in British pounds, rounded to two decimals:

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

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

```text
[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.
