How Gatemi Currency Switcher Works

Your products have one price, in your store's base currency. The switcher never changes it. It changes what WooCommerce reports the currency to be for one shopper, and converts each price on its way to the page. Turn the plugin off and every price is exactly what you typed.

1. Which currency a shopper is in

A shopper's currency is a cookie in their browser. The free edition's is gmcswf_currency; the full edition's is gatemi_csw_currency. It lasts 30 days.

The free edition decides it in this order:

  1. A link. The switcher is a list of plain links such as ?gmcuf=EUR. Following one stores that currency, as long as it is your base currency or one of your active extra currencies. An unknown code is ignored.
  2. The cookie. A choice made earlier stands.
  3. Location, when Visitor detection is on. WooCommerce's geolocation looks up the visitor's country; if that country's currency is one of your extra currencies, the visitor starts in it. This runs only when there is no cookie yet, and a followed link always wins.
  4. Otherwise, your base currency.

The full edition works the same way with its own query argument and cookie, plus a separate gatemi_csw_currency_geo cookie for the location guess, so a shopper's own choice and the guess are kept apart. Its Start visitors in their local currency setting is on by default.

Because the switcher is made of ordinary links, it works with no JavaScript, and a page cache can serve the switcher itself. The request that sets the cookie is marked as not cacheable, so one shopper's choice is never cached and handed to the next.

2. What is converted

When the shopper is in an extra currency:

  • WooCommerce's currency is reported as that currency, so its symbol and code appear everywhere WooCommerce prints a price.
  • Product prices — price, regular price and sale price, for simple products and for variations — are multiplied by the rate.
  • The currency's decimals and symbol position replace WooCommerce's own, when you set them.

Both editions also convert:

  • shipping rates and their taxes (woocommerce_package_rates), with the currency carried in each shipping package so stored rates are worked out again when the shopper switches,
  • cart fees (after every other plugin has added its own; a fee already in the shopper's currency can opt out — gmcswf_convert_fee in the free edition),
  • fixed coupon amounts and coupon minimum and maximum spend (a percentage coupon has no currency and is left alone),
  • a variable product's price range, with WooCommerce's price cache kept separate per currency.

Shipping, fees and coupons convert at the rate alone — the rounding increment and charm pricing are for catalogue prices.

Full edition also converts the price filter widget's minimum and maximum, and applies its thousand and decimal separators per currency.

The arithmetic

For a converted price, the free edition does:

  1. Multiply by the rate. £10.00 × 1.17 = €11.70.
  2. Round to the Round prices to step, if set. To 0.50: €11.50.
  3. Charm pricing, if ticked: up to the next whole number less one cent. €11.99.
  4. Round to the currency's decimals.

The full edition first adds the exchange fee to the rate (a percentage of it, or a fixed amount), converts, then applies the Price rules for the range the converted price falls in: its rounding step and its ending (.99, .95, .49 or none).

Neither edition rounds or reshapes a price in your base currency.

3. Where rates come from

A fixed rate is the number you typed. It never changes on its own.

An automatic rate is fetched on a schedule — twice a day in the free edition, every hour in the full edition:

  1. The plugin asks https://gatemi.com/api/v1/exchange-rate.php for the rate from your base currency to the extra currency.
  2. If that does not answer with a usable rate, it asks https://open.er-api.com/v6/latest/ for all rates from your base currency at once.
  3. A rate is stored only when a service answered with a positive number for exactly the pair that was asked for.

A failed fetch never changes a stored rate. If both services are unreachable, the last good rate stays. The scheduled job only exists while at least one currency is automatic. In the free edition, saving the settings also fetches new automatic rates immediately.

4. Payment methods per currency

Each currency can be limited to some payment methods. When the shopper is in that currency, the checkout's list of available payment methods is narrowed to those. With none chosen, all are offered. Use it for a gateway that cannot take a particular currency, so a shopper never chooses a payment method that would fail at the last step.

Full edition: with Let customers pay in their selected currency off, the order is always charged in your base currency. The shopper browses in theirs; the cart and checkout show the base-currency amount beside the converted one, and a notice says what they will be charged in.

5. What is recorded on the order

When an order is placed — on the classic checkout, the Checkout block or through the Store API — the plugin writes the conversion onto the order:

  • the rate used,
  • the order's currency and your base currency,
  • the order total, tax total, shipping total and net total converted back into your base currency.

So your reports can say what an order was worth in your own currency on the day it was placed, without guessing a rate afterwards. A refund uses its parent order's rate, so it is reversed at the rate the money moved at. If no rate is on record for a foreign-currency order, nothing is stamped — no record is better than a wrong one. The meta keys are in the Developer reference.

6. The switcher

  • Free edition: the sticky bar (pinned left or right), the Currency Switcher and Currency Switcher Sticky Bar blocks, and the [gatemi_currency_switcher] shortcode. Each lists your base currency then your extra currencies, with country flags. The current one is shown without a link. With no active extra currency, nothing is shown.
  • Full edition: the same two blocks, a dropdown on the product page, a floating sidebar in two designs, a navigation-menu item, and three shortcodes.

The flags are SVG files shipped with the plugin. No image is loaded from another site.

7. Other plugins

Both editions carry compatibility modules for around fifty plugins — subscriptions, bookings, product bundles and add-ons, deposits, dynamic pricing, WPML, Dokan, page caches such as WP Rocket, LiteSpeed Cache and SiteGround Optimizer, and more. A module only switches on when its plugin is active, and one that fails is skipped rather than breaking the shop.

Shopping Cart
Scroll to Top