Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:

I have set up the WPML on my website and chosen the currency based on the site language.

Could you provide me a hook to switch currency based on the checkout page country location?

If I change the checkout page country location, the currency must change.

Solution:

Changing the country on the checkout page is not supposed to change the currency of the product. In other words, what you expect on the checkout page will not happen with WooCommerce Multilingual & Multicurrency features. However, you can add a Language Switcher to the site, and the users of your site will be able to change the currency, and this way, have the expected currency on the checkout page. You can read about adding a currency switcher in our guide here.

https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#adding-a-currency-switcher-to-the-front-end

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Itamar 1 year, 7 months ago.

Assisted by: Itamar.

Author Posts
November 21, 2023 at 8:45 am

fionaM-12

I have setup the wpml on my website hidden link
and chooses the currency based on site language. Could you provide me hook to switch currency based on checkout page country location? if i change the checkout page country location then currency need to change.

November 21, 2023 at 11:02 am
November 21, 2023 at 3:34 pm #14888713

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I discussed this issue with our second-tier supporters. It turns out that changing the country on the checkout page is not supposed to change the currency of the product. In other words, what you expect on the checkout page will not happen with WooCommerce Multilingual & Multicurrency features. However, you can add a Language Switcher to the site, and the users of your site will be able to change the currency, and this way, have the expected currency on the checkout page. You can read about adding a currency switcher in our guide here.

https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#adding-a-currency-switcher-to-the-front-end

Please let me know if you have further questions about this issue.

Regards,
Itamar.

November 23, 2023 at 8:52 am #14905039

fionaM-12

This works when we switch to "Client Location".

We need to one of these things

1) Can we get a switcher Shortcode which can be used even when we are on " Client Location " Setting.

2) Can somehow both the modes be combined (Insted of OR can we make it AND) where Client location and Client Language works together?

November 23, 2023 at 5:04 pm #14910517

Itamar
WPML Supporter since 02/2016

Languages: English (English )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

You wrote: "This works when we switch to "Client Location".

I must mention that I based my answer on this fact - "Site Language" is set on the site. I saw this on your site when I checked it while we were in chat. And this is also the setting I see on your site now. Please see the attached screenshot.

You asked:

1) Can we get a switcher Shortcode which can be used even when we are on " Client Location " Setting.

In most cases, the currency switcher should show on the site even if you use the "Client Location" option. I wrote "in most cases" because if you set the currency to show only for specific countries, then the currency will not show because only one currency is set for this country. I tested this scenario on my test site. If "Client Location" is selected and the currencies are set to show for "All countries" then the currency switcher will show.

Whether you set the currency from the default settings or use the shortcode, the above is true. You can see this section of our guide on the currency switcher shortcode.

https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#currency-switcher-shortcode

You also asked:

2) Can somehow both the modes be combined (Insted of OR can we make it AND) where Client location and Client Language works together?

I'm sorry, but no, they cannot work together.

You may want to check if the following officially compatible plugin, called IP2Location Redirection, can help you.

https://wpml.org/plugin/ip2location-redirection/

Otherwise, what you are trying to achieve is custom work, which is outside the scope of our support forum. In this case, if you need further help with what you are trying to achieve, I would suggest you consider contacting one of our certified partners from this link:

https://wpml.org/contractors/

With our contractors, you might get the custom assistance you need to get on with your project.

Before doing so, please have a look here:

https://wpml.org/documentation/about-wpml-contractors/what-type-of-work-you-can-expect-from-contractors/

Best Regards,
Itamar.

2023-11-23_17-47-05.png