Skip Navigation

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

Problem:
I am having an issue with changing the Multi-currency shortcode location to show after the "Add to Cart" button on my WooCommerce site.

Solution:
Disable the WCML currency switcher from the product details page by going to WP > WooCommerce > WCML > Multi-currency. Then, add the following code snippet to your theme in the desired location:

do_action('wcml_currency_switcher', array(
  'format' => '%code%',
  'switcher_style' => 'wcml-horizontal-list'));

Relevant Documentation:
https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#currency-switcher-shortcode
https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/

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

Last updated by tkkI 2 years, 4 months ago.

Assisted by: Andreas.

Author Posts
January 22, 2023 at 9:57 am #12866221

tkkI

I need to change the Multi-currency shortcode location to show after adding to card button, please help and rearrange it.

Screenshot 2566-01-22 at 16.54.31.png
January 22, 2023 at 11:24 am #12866419

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

Before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

You can learn about adding the currency switcher shortcode in our guide here.

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

You probably need to add this shortcode to the relevant template in your theme. Here is another guide that may help you achieve this.

https://wpml.org/documentation/support/making-woocommerce-themes-multilingual-and-multi-currency-ready/#multi-currency-payment-options

Regards,
Itamar.

January 23, 2023 at 9:56 am #12871013

tkkI

I need to know the exact PHP snippet to make that shortcode show next to add to cart button.

Please help and advise that

January 23, 2023 at 10:33 am #12871473

Andreas

Thank you very much for the reply.

I tried to check your site because it seems that something is breaking the currency switcher position, but I couldn't because it is locked.

In general, we are using hooks in order to position the currency switcher. No need to edit anything. You can use our hooks to place a currency swither wherever you need.

Please read our hooks page here :

https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/

January 23, 2023 at 11:25 am #12872071

tkkI

Please use
demo
123456

To access staging site

January 23, 2023 at 11:46 am #12872275

Andreas

Thank you very much for the access.

I checked it and it is what I told you. The product Meta section is at the bottom, so this is the reason the currency switcher is there.

You can use the hooks I have shared with you, or you can read our documentation for custom currency template here:

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

I hope this helps. Please let us know how it goes or if you need any further assistance. I'll gladly help you. 🙂

Regards,
Andreas

January 23, 2023 at 12:03 pm #12872437

tkkI

I’m not sure how the hook works can you please paste me the example of the PHP snippet?

January 23, 2023 at 12:30 pm #12872593

Andreas

I cannot share the whole custom code , because it is out of the scope of this support.

But I can give you some instructions.

First, you can totally disable WCML to show currency swither from the product details page.

You can find the setting in WP > WooCommerce > WCML > Multi-currency

Then you can go to your theme and add something like this, in the place you wish to display the currency :

do_action('wcml_currency_switcher', array(
  'format' => '%code%',
  'switcher_style' => 'wcml-horizontal-list'

Or choose the best settings you wish, from the documentation I have already shared.

I hope this helps. Please let us know how it goes or if you need any further assistance. I'll gladly help you. 🙂

Regards,
Andreas