WP SITES

3099 Coded Tutorials & 300 Plugins

How to Use MetalpriceAPI for Live Gold Prices in WooCommerce

If you want your WooCommerce store to always reflect the latest live gold price, you can connect MetalpriceAPI to the gold pricing settings in the Dynamic Gold Price for WooCommerce Products plugin.

This guide walks you through getting your MetalpriceAPI key, configuring the plugin, and confirming that prices are updating based on your store currency.

Step 1 : Get Your MetalpriceAPI Key

  1. Go to the MetalpriceAPI Dashboard
  2. Log in to your account or create a free account if you don’t already have one.
  3. Once logged in, locate your API key in the dashboard. Copy the API key exactly as shown.
  4. Keep this key handy – you’ll paste it into the plugin settings in the next step.

Step 2 : Open the Gold API Settings Page

  1. In your WordPress admin, look in the left-hand admin menu.
  2. Click “Gold API Key”.
  3. This opens the main settings page for the Dynamic Gold Price for WooCommerce Products plugin

Step 3 : Enter Your MetalpriceAPI Key

On the Gold API Settings page you’ll see an “API Configuration” section.

  1. Find the field labeled “Metalprice API Key”.
  2. Paste your MetalpriceAPI key that you copied from the MetalpriceAPI Dashboard.
  3. Click “Save Changes” (or the standard WordPress “Save” button at the bottom of the page).

The plugin will now be able to call MetalpriceAPI using your key.

Step 4 : Configure the Base Currency for MetalpriceAPI

MetalpriceAPI returns rates based on a “base” currency. The plugin is designed to use your WooCommerce store currency by default, but you can override this if needed.

  1. In the same “API Configuration” section, find “Metalprice Base Currency”.
  2. If you want to use your WooCommerce store currency (recommended), leave this field empty. The plugin will automatically use whatever you’ve set as your store currency (for example USD, EUR, GBP).
  3. If you have a specific reason to use a different base, enter a 3-letter code like:
    USD, EUR, GBP, AUD, CAD, etc.
  4. Save your changes again.

Behind the scenes, the plugin will call MetalpriceAPI’s live rates endpoint using your base currency and the XAU (gold) symbol, then convert the returned ounce price into a per-gram price.

Step 5 : Select MetalpriceAPI as the Price Source

Now that the key and base currency are configured, you need to tell the plugin to actually use MetalpriceAPI for pricing.

  1. On the same settings page, scroll to the “Price Source Configuration” section.
  2. Find the “Gold Price Source” dropdown.
  3. Choose:
    “Metalprice API”
  4. Save your changes.

From this point on, whenever the plugin fetches the current gold price, it will use MetalpriceAPI instead of the premium API or free API.

Step 6 : Confirm the Live Rate and Currency on the Settings Page

At the top of the Gold API Settings page, the plugin shows a status line with the current gold price and the active source.

When MetalpriceAPI is selected, you’ll see something like:

Current Gold Price Status: 123.45 USD per gram (Source: Metalprice API)

Key points here:

  • The number is the current live price per gram.
  • The currency is your WooCommerce store currency (or the Metalprice Base Currency if you have explicitly set one).
  • The source label confirms that MetalpriceAPI is being used.

If there’s a problem with your key or API response, this status area will show a readable error message instead.

Step 7 : Run a Bulk Update to Apply New Prices

Once you’ve confirmed that MetalpriceAPI is configured correctly, you can push the live rate into your products.

  1. In the admin menu, go to:
    Gold API Key → Update Gold Prices
  2. Click “Update Now”.
  3. The plugin will:
  • Fetch the latest price per gram from MetalpriceAPI.
  • Recalculate prices for all products and variations that have gold weight and markup configured.

Step 8 : Verify Prices on the Front End

Finally, check your WooCommerce store:

  1. Open a product that uses gold pricing and make sure it has:
  • Gold weight (in grams)
  • Markup percentage
  • Optional fixed extra, if you’re using that feature

2. Confirm that the price matches the formula:
(Live gold price per gram × weight) × (1 + markup% / 100) + fixed extra

3. If you’ve configured multiple products or variations, spot-check a few to ensure they’re all reflecting the MetalpriceAPI-based rate.

    Summary

    By combining MetalpriceAPI with the Dynamic Gold Price for WooCommerce Products plugin, you can:

    • Pull live gold prices directly from MetalpriceAPI.
    • Use your WooCommerce store currency automatically as the base.
    • Apply that rate to all products and variations with gold weight and markup.
    • Control logging and visibility with the debug checkbox and the current-price status on the settings page.

    Get your key from the MetalpriceAPI Dashboard, drop it into the plugin settings, select “Metalprice API” as the source, and your WooCommerce store will track live gold prices with minimal ongoing effort.

    Was this helpful?

    Yes
    No
    Thanks for your feedback!

    Leave a Reply