WPML & Woocommerce Multilingual – Force currency to country

Featured image for “WPML & Woocommerce Multilingual – Force currency to country”

Since you are here you may encountered the same issue earlier with one of your past projects. How the heck can you force a specific currency within Woocommerce Multilingual from WPML?

In the end it is quite simple. My goal was to show a customer only the currency of his billing country, without affecting the chosen language of the shop.

Down below you see a simplified version of what I used to archive that.
The main goal is to force the country (Defined as $new_country_code) to a specific currency (Defined as $multicurrencies)

The snippet checks if the country ($new_country_code) is available within the defined currencies ($multicurrencies) and if so, it will output the language associated with it.
Also, the logic only applies to the frontend.

Sign up for WP Webhooks news

Get the latest features, tutorials and promotions directly into your inbox.