WPCS - WordPress Currency Switcher Professional

WordPress currency switcher not converting prices: causes and fixes

The switcher is on the page, a visitor picks euros, and the prices stay in dollars. Or they turn into 0.00, disappear, or the shortcode itself shows up as text. When a WordPress currency switcher is not converting prices, the cause is almost always on a short list, and a two-line test page tells you which part of the list to check. This guide covers WPCS – WordPress Currency Switcher, the plugin for prices in posts, pages and custom content.

Start with a two-line test page

Create a draft page that contains only these two shortcodes:

[wpcs]
[wpcs_price value=100]

Open the preview in a private browser window, where you are not logged in, and pick each currency in the switcher. The result splits the problem in two: the plugin setup, or the place where your real prices are printed.

What you see on the test pageWhere to look
100 converts correctly in every currencyThe plugin works. Your real prices are not printed by the shortcode, or are written wrong: the next two sections
0.00 in one or more currenciesThe exchange rate of that currency is 0 or empty
The page reloads but the amount stays the samePage cache or currency storage
Picking a currency does nothingA JavaScript problem on the page
[wpcs_price value=100] is printed as textWPCS is not active on this site
The test works, but WooCommerce product prices never changeThe wrong plugin for a shop

The price is not printed by [wpcs_price]

This is the most common cause. WPCS does not look for amounts in your pages. It converts only what its [wpcs_price] shortcode (or its PHP API) prints. A price typed as plain text, such as "Our rates start at $20", a price field of the theme, a pricing-table widget or a cell of a table plugin stays exactly as written, no matter which currency is selected. Replace each of those amounts with the shortcode, written in your base currency:

Our rates start at [wpcs_price value=20] per hour.

If the theme prints the price from its own field in a template, change the template in a child theme to echo do_shortcode('[wpcs_price meta_value="price"]');, where price is the name of the custom field. The [wpcs_price] reference lists all attributes.

The field does not run shortcodes

If the shortcode works on the test page but appears as text in your layout, the field it sits in prints its content as plain text. Typical examples are heading and button widgets, pricing-table widgets, cells of table plugins, theme option fields and dynamic tags that output a custom field. Move the price into a text or shortcode element, or print it from a template. If a third-party element must hold the price, its author has to pass that field through WordPress's do_shortcode(); ask them to.

A shortcode inside another shortcode

[wpcs_price value="[acf field=price]"] never works: WordPress does not run shortcodes inside shortcode attributes, so value receives the literal text. Let WPCS read the field itself with [wpcs_price meta_value=price]; simple ACF fields are stored under their field name. For rows of an ACF repeater, print the price in the template:

<?php
// Child theme template: ACF repeater "plans" with the sub field "price".
if (have_rows('plans')) {
    while (have_rows('plans')) {
        the_row();
        echo do_shortcode('[wpcs_price value="' . floatval(get_sub_field('price')) . '"]');
    }
}

The price turned into a link

WPCS prints the price as a plain <span class="wpcs_price"> without any link. If the price is underlined or clickable, the page editor wrapped the shortcode in a link when you inserted it; Thrive Architect does this, for example. Delete the element and insert the shortcode again as plain text, then check the element's HTML.

The shortcode is written wrong

A shortcode with a small typo either prints nothing, prints 0.00, or is shown as text. Check these points:

  • Spaces. One space after the shortcode name and between attributes: [wpcs_price type="fixed" value="USD:20,ZAR:350"]. Without the first space, [wpcs_pricetype="fixed" ...] is a different, unknown shortcode.
  • Straight quotes. Text copied from a word processor, a document or a chat often contains curly quotes (” “). WordPress treats them as part of the value, so type is no longer fixed and value is no longer a number, which gives 0.00. Retype the quotes in the code or text view of the editor, or leave them out for single values: value=100.
  • A plain number. value is an amount in the base currency with a dot for decimals: 1500 or 1500.50. PHP reads the number up to the first character it does not understand, so 1,500 is read as 1, 1.500,00 as 1.5 and $1500 as 0.
  • Empty value. value=0, an empty value or an empty custom field prints nothing at all. With meta_value, check the exact meta key, and add post_id=123 when the field belongs to another post.
  • Fixed prices. With type="fixed", list every currency of the site as CODE:amount pairs separated by commas. A currency missing from the list shows none.

The exchange rate is 0 or empty

A converted price is the base amount multiplied by the rate of the selected currency, so a rate of 0 shows every price as 0.00. A new currency row starts with rate 0 until you fetch or type a rate. When fetching fails, for example because the code is not a valid ISO 4217 code or the aggregator needs an API key you have not entered, the rate field receives an error text such as There is no data for these currencies instead of a number, and saving the page stores that rate as 0.

  1. Open Settings → Currency Switcher, tab Currencies, and look at the rate of every currency. The base currency (the selected radio button) has rate 1.
  2. Press Update all rates, or the update button next to a single rate, or type the rate by hand. If the field shows a message instead of a number, check the code and the Currency aggregator and Aggregator API key on the Options tab; each message is explained in currency switcher "no data for" currency error, and code problems in why the rate auto update is not working.
  3. Press Save options and clear the page cache.

If prices show 0.00 for a moment and then the right amount, the page comes from a cache made while a rate was still 0, and I am using cache plugin on my site redraws the prices after loading. Fix the rates, then clear every cache.

The page does not follow the switcher: cache, storage, JavaScript

When a visitor picks a currency, the page reloads with ?currency=EUR in the address, the plugin saves the choice in the storage set in Currency storage, and every following page is built with prices in that currency. Three things break this chain.

  • Page cache. A cached page holds the prices in the currency it was cached with, so the next page shows the old currency. On the Options tab, set I am using cache plugin on my site to Yes and clear all caches: plugin, server and CDN. The browser then sends one request to admin-ajax.php (action wpcs_get_prices_html) after the page loads and redraws every [wpcs_price] in the visitor's currency. A typical sign of this cause: everything works while you are logged in, because caches skip administrators.
  • Currency storage. If the currency jumps back to the welcome or GeoIP currency right after switching, the chosen storage does not keep the value on your server. Sessions are the usual culprit: set Currency storage to transient, the default.
  • JavaScript. The drop-down is driven by JavaScript. If picking a currency does nothing, open the browser console (F12) and reload: an error from another script, or an optimization plugin that delays, defers or combines scripts, stops the switcher. Fix the error, or exclude /wp-content/plugins/currency-switcher/js/ and jQuery from those features, then clear the caches.

Plugin-specific exclusions and server caches you cannot switch off are covered in currency switcher not working with a cache plugin.

WooCommerce product prices do not change: the wrong plugin

WPCS never changes WooCommerce product prices, the cart or the checkout. That is its design, not a fault: it converts prices in content only. A shop needs the sister plugin FOX – WooCommerce Currency Switcher. If you have the FOX download, make sure you installed the main plugin archive and not the bonus WPCS archive that comes with it in a separate folder. The differences are explained in WordPress Currency Switcher vs WooCommerce Currency Switcher.

Checklist

  • The test page with [wpcs] and [wpcs_price value=100] converts in a private window.
  • Every price that should switch is printed by [wpcs_price], in a field that runs shortcodes, and not nested in another shortcode.
  • Spaces between attributes, straight quotes, plain numbers in the base currency.
  • No currency has rate 0 or an empty rate.
  • With a page cache: I am using cache plugin on my site is Yes and all caches are cleared.
  • No JavaScript errors in the console.

If every point checks out and a price still does not convert, open a topic on the WPCS support forum with a link to the page and the exact shortcode as you typed it.