PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Change Currency Based on Delivery Country

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi there,

Thank you very much for your code snippet here - https://currency-switcher.com/possible-delivery-country-change-currency/ I'm using the code on my site.

I noticed a potential bug. Please can you take a look and let me know if you have a clever fix?

To recreate the issue:

1) Cart Page:  change the shipping country (under Basket Totals > Shipping > Change address) the currency won't change based on GeoIP currency rules. However, clicking the Proceed To Checkout button and currency will change on the checkout page correctly based on the GeoIP currency rules.

2) Checkout Page: change the shipping country (under Billing details > Country/region) the currency won't change based on GeoIP currency rules. However, reload the page in Chrome and currency will change correctly based on the GeoIP currency rules. Reload the page in Firefox and currency still won't change.

It seems like an ajax related issue. Is it possible to tweak the code to get round this? Thank you.

 

PS: Tested with WooCommerce's default StoreFront theme and I'm seeing the same behaviour.

Hello

  1. this will never work on the cart page
  2. Please  try to use key to  billing_country - https://c2n.me/4aLWwhH.png

Thank you for your quick reply, Pablo. :)

Re: Please  try to use key to  billing_country

I'm using the same code in your screenshot $data['shipping_country']

What is key? Do you have an example? Are you suggesting me use $data['billing_country'] instead? What happens if the user then enter a different country for shipping?

Thank you for your help.

Hello

 Are you suggesting me use $data['billing_country'] instead? - Yes!

If you change the key then the code will use this address - https://c2n.me/4aMNOcF.png