Daniyal Dev — Dev Project

Show Store Prices in Any Currency, Without the Headache

The WooCommerce Price Dropdown Plugin detects your visitor’s country, switches to their currency automatically, and converts every price on your store in real time. No subscriptions. No API keys to hunt down. Just install it and it works.

Version 1.0.0
WooCommerce 6.0+
193 Countries
155 Currencies
PHP 7.4+

01Why Currency Actually Matters on Your Store

If someone visits your store from Germany and sees prices in US dollars, they’ll mentally try to convert it, probably get it wrong, and feel unsure. Most people don’t complete purchases when they feel unsure.

It’s not about showing a different symbol. It’s about removing friction. When someone from Pakistan sees a price in PKR, or someone from Japan sees it in JPY, the decision feels easier. That’s the whole point of the WooCommerce Price Dropdown Plugin.

Here’s what it takes off your plate:

  • Automatic detection on first visit

    Uses the visitor’s IP address to identify their country and set the right currency before the page loads.

  • Live price conversion across your entire store

    Every product price, variation, shipping rate, and coupon amount gets converted using up-to-date exchange rates.

  • A clean dropdown for manual switching

    Visitors can switch to any country from a searchable dropdown with flags and currency codes. Works with keyboard too.

  • Their choice is remembered

    The selected currency persists across pages and sessions for 30 days, using both WooCommerce session storage and a secure cookie.


02Everything the Plugin Handles for You

🌐

IP-Based Country Detection

Detects your visitor’s country on their first visit using geolocation. Falls back gracefully if detection isn’t possible.

💱

Live Exchange Rates

Fetches fresh rates on a schedule you control (every 6, 12, or 24 hours). Rates are cached so it never slows your store down.

🏷️

Full WooCommerce Price Conversion

Converts product prices, variation prices, shipping rates, and coupon amounts. Handles zero-decimal currencies like JPY and KRW too.

🔍

Searchable Currency Dropdown

The dropdown includes all 193 countries with flag emojis and currency codes. Visitors can search by country name, code, or currency.

📋

Order Currency Data

Saves the exact currency, symbol, and exchange rate to every order so you always know what rate was used at checkout.

📱

Mobile-Ready Bottom Sheet

On small screens, the dropdown becomes a bottom sheet. Works with touch, keyboard navigation, and screen readers.

🔒

Secure Session Handling

Uses WooCommerce sessions as the primary store and a secure, HttpOnly cookie as fallback. No sensitive data is exposed to JavaScript.

⚙️

Simple Admin Settings

Three settings, a manual rate refresh button, and a full exchange rates table right inside your WooCommerce admin.


03How Country Detection Works Behind the Scenes

When someone visits your store for the first time, the plugin reads their IP address and checks it against ipinfo.io, a geolocation service with a generous free tier. It gets the country code, looks up the matching currency, and sets it as the active currency for that session.

The plugin is smart about which IP to use. Visitors behind Cloudflare, a proxy, or a load balancer will have a different IP in the standard REMOTE_ADDR header. So it checks headers in priority order:

PHP
// Priority order for IP detection
HTTP_CF_CONNECTING_IP // Cloudflare (most accurate behind CF)
HTTP_X_FORWARDED_FOR // Proxies and load balancers
HTTP_X_REAL_IP // Nginx reverse proxy
HTTP_CLIENT_IP // Some proxy setups
REMOTE_ADDR // Direct connection (fallback)

Detection only runs on the front end, first visit, when no currency has been selected yet. It skips admin pages, AJAX requests, REST API calls, and CLI runs entirely, so it never adds overhead where it isn’t needed.

Testing locally? Local and private IP addresses (like 127.0.0.1 or 192.168.x.x) can’t be geolocated. The plugin falls back to your WooCommerce store’s base currency automatically so your local setup never breaks.

Geolocation Results Are Cached

Once a visitor’s country is detected, the result is cached for 24 hours using a WordPress transient keyed to a hash of their IP address. The same visitor won’t trigger another API call during that window, even across multiple page loads.


04Try the Dropdown Right Here

This is an accurate preview of how the currency selector looks and behaves on your store. The search, keyboard navigation, and selection all work the same way as the real plugin.

Live demo
No countries found

Click the button above, then search or select a country. Keyboard navigation works too: Arrow keys to move, Enter to select, Escape to close.


05Getting It Installed in a Few Steps

Installation works like any WordPress plugin. Download the zip file from the section at the bottom of this page, then:

  1. Go to Plugins > Add New in your WordPress dashboard and click Upload Plugin
  2. Upload the downloaded .zip file and click Install Now
  3. Activate the plugin. On activation, it creates two database tables, seeds country and currency data, fetches initial exchange rates, and schedules a daily cron job
  4. Navigate to WooCommerce > Multi-Currency to review the settings and confirm rates loaded correctly
  5. Add the shortcode [price_dropdown] to any page, header widget, or template file where you want the selector to appear
No restart needed. Everything sets up during activation. You should see exchange rates populated in the admin table immediately after activating.

06Placing the Currency Selector on Your Pages

The dropdown renders via a simple shortcode. Drop it into a page, a widget, or a theme template file anywhere you want visitors to see and switch currencies.

The Shortcode and Its Attributes

[price_dropdown]
Default: shows flag, currency badge, and “Select Country” placeholder.
[price_dropdown show_flag="yes" show_currency="yes" placeholder="Select Country"]
Full example with all attributes explicitly set to their defaults.
[price_dropdown show_flag="no" placeholder="Choose your region"]
Hides the flag, uses a custom placeholder label.
Attribute Default What it does
show_flag “yes” Show or hide the country flag emoji next to the selected country name
show_currency “yes” Show or hide the currency code badge (e.g. USD, EUR) in the trigger button
placeholder “Select Country” The label shown in the button before a country has been selected

Using It in a PHP Template File

If you want to add the dropdown directly inside a theme template or header file rather than a page, use do_shortcode():

PHP
<?php
// Inside header.php, functions.php partial, or any theme template:
echo do_shortcode( ‘[price_dropdown show_flag=”yes” show_currency=”yes”]’ );
Price Dropdown Preview

07The Three Settings Worth Knowing About

The plugin is intentionally lean on configuration. You’ll find the settings under WooCommerce > Multi-Currency. There’s a status bar at the top showing the last rate update, when the next one is scheduled, and how many currencies are in the database.

  • ipinfo_token
    ipinfo.io API token (optional). The free tier gives you 50,000 geolocation lookups per month without any token. If your store gets more traffic than that, add a token here to increase your limit. Get one free at ipinfo.io/signup.
  • auto_detect
    Enable automatic country detection. When checked, the plugin will detect a new visitor’s country from their IP and set their currency automatically. If unchecked, the dropdown will still work for manual selection, but nothing gets set until the visitor picks a country themselves.
  • refresh_interval
    Exchange rate update frequency. Choose between every 6 hours, 12 hours, or once daily. Daily is the default and is fine for most stores. Rates don’t move dramatically hour to hour for major currencies. There’s also a manual refresh button if you ever need to force an update immediately.
Settings Page Preview
The exchange rates table on the settings page shows every currency’s current rate relative to USD. It’s a good quick-check to confirm rates are loading correctly after activation.

08Prices Convert Across Your Entire Store, Not Just Product Pages

A multi-currency plugin that only converts product page prices isn’t that useful. This one hooks into every price-related part of WooCommerce so the conversion is consistent everywhere.

📦
Product Prices
🏷️
Sale Prices
🔀
Variation Prices
🚚
Shipping Rates
🎟️
Coupon Amounts
🛒
Cart and Checkout

Zero-Decimal Currencies

Some currencies like JPY, KRW, and VND don’t use decimal places. The plugin detects these and formats prices accordingly so you never end up showing something like “¥1,299.00” when it should be “¥1,299”.

Currencies handled as zero-decimal: BIF, CLP, DJF, GNF, ISK, JPY, KMF, KRW, MGA, PYG, RWF, UGX, VND, VUV, XAF, XOF, XPF

Symbol Positioning

Some currencies display their symbol after the number (like 100 kr for Swedish Krona). The plugin handles suffix placement for: SEK, NOK, DKK, ISK, HUF, PLN, CZK, RON, and BGN so formatting looks correct in each region.


09See the Conversion in Action

Type any price in USD and pick a currency to see how the plugin converts it. The exchange rates shown here are representative values for illustration.

Price converter demo


💶
Converted price
€44.59
1 USD = 0.91 EUR

10Every Order Keeps a Full Currency Record

When an order is placed, the plugin saves the currency details that were active at checkout as order meta. This works for both the classic WooCommerce checkout and the newer block-based checkout.

_wcmc_currency_code
The ISO currency code, e.g. EUR, GBP, JPY
_wcmc_currency_symbol
The symbol used at checkout, e.g. €, £, ¥
_wcmc_exchange_rate
The exact rate used when the order was placed
_wcmc_country_code
The country code that was active, e.g. DE, GB, JP

This means you’ll always know what exchange rate the customer saw, which matters for refunds, disputes, or reconciliation.

Order Page Screenshot with Meta

11Built with Standard WordPress Security Practices

The plugin follows WordPress and WooCommerce security standards throughout. Nothing unusual, nothing cutting corners.

🔐
Nonce Verification
Every AJAX request is validated with a WordPress nonce before any action is taken.
🛡️
Prepared SQL Queries
All database queries use $wpdb->prepare() to prevent SQL injection.

Input Sanitization
Country codes and all user inputs are validated and sanitized before use.
🍪
Secure Cookies
The currency cookie is HttpOnly, Secure (HTTPS), and SameSite Lax to prevent unauthorized access.
👤
Capability Checks
Admin functions require the manage_woocommerce capability.
🔒
Output Escaping
All HTML output is escaped with esc_html(), esc_attr(), and esc_url().
Note on IP addresses: Visitor IPs are never stored permanently. They’re used only to determine the country, and the geolocation result is cached with a hashed key for up to 24 hours. No IP tracking, no logs.

12What You Need Before Installing

Requirement Minimum Version Notes
WordPress 5.8+ Works on any recent WordPress install
WooCommerce 6.0+ Tested up to WooCommerce 9.0. Compatible with both classic and block checkout
PHP 7.4+ PHP 8.x is also supported and recommended
MySQL / MariaDB Standard WP requirement Creates two custom tables on activation
HTTPS Recommended The currency cookie uses the Secure flag when your store runs on HTTPS
WP Cron Enabled Used for scheduled daily exchange rate updates. Works with both WP Cron and system cron
Outbound HTTP Required The server needs to make outbound requests to fetch exchange rates and geolocation data

13Download the WooCommerce Price Dropdown Plugin

Free to download and use. Works with WooCommerce 6.0 and up. No account required, no license keys.

Woocommerce Price Dropdown Plugin v1.0.0 • 37.93 KB
20

Currency confusion shouldn’t be the reason someone leaves your store. Install it, place the shortcode, and that problem’s handled.

How did this post feel?

Share this with your dev circle

Found this useful? Boost another developer by sharing it forward.

Link copied to clipboard