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 2 replies, has 2 voices.

Last updated by kevinK-12 2 months, 3 weeks ago.

Assigned support staff: Yvette.

Author Posts
July 22, 2019 at 9:51 am #4255589

kevinK-12

Dear WPML support team

I have an online store with 2 currencies (CHF and EUR). I would now like to redirect my visitors from Germany to the EUR currency. In the article https://wpml.org/forums/topic/can-i-make-the-website-display-in-a-certain-currency-via-url/ I have found a solution for adding the currency switch and it works fine. The only problem is, that after adding this function to the functions.php file in my theme, the WordPress Backend is not longer available and returns an error / blank page.

Has there been a change in WooCommerce since the post has been made in 2015 which would cause this to break?

Thank you and best regards,
Kevin

July 22, 2019 at 2:39 pm #4258827

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello

1. A blank page usually means a PHP conflict and I would activate the WordPress debug to get more information on the possible error.

Can you please do this and write back with any messages you see?

2. Has there been a change in WooCommerce since the post has been made in 2015 which would cause this to break?

2015 in WordPress world is ancient. I would not be surprised if any kind of custom code is no longer valid. In fact, this is one of the reasons we now refrain from providing custom code support on the forum since we cannot guarantee that it is going to still work in any future release.

3. Here is the current recommended ways to implement currency switcher solutions
Here is the link to our current WCML API where I can see that the call might need to be change to be:
https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/#hook-1113509

Notice that there is no more call to "action" but rather to a "filter".
https://wpml.org/wcml-hook/wcml_client_currency/

You might try changing the call format to be in-line with what the current requirements for that call are.

July 23, 2019 at 9:39 am #4264647

kevinK-12

My issue is resolved now. Thank you!