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.

Author Posts
August 26, 2018 at 1:11 am #2675560


We are working to get our webshop multi currency.
Now the system works perfectly, but we would like to get our products on Google Shopping.
Our main currency is EUR, but to advert in UK the links have to go to the productpage with the GBP currency.
Now we used this code:

add_action( 'wcml_client_currency', 'currency' );
function currency( $current_currency ) {
global $woocommerce,$sitepress;

$currency = isset( $_GET['currency'] ) ? esc_attr( $_GET['currency'] ) : $current_currency;
$currency = strtoupper( $currency );

$woocommerce->session->set('client_currency', $currency);

return $currency;

This worked perfectly, only it gives a blank page on the WP-Admin.
Now this same issue happend to someone els:

Do you have the code/solution to have this working?


August 27, 2018 at 9:44 am #2677469


Hello Johan,

thanks for contacting us on this.

You could try to use a currency parameter in the link and provide that link to Google.

There is a way to open the product via a link with GPB selected in the price tag using a WPCML Hook to make a customized view before the client arrives at the product page.

This works on a clean install with just the Standard-Theme and the main WPML and WooCommerce Multilingual setup. You can try if that also works on your specific site settings:

You need to use a WPCML Hook to retrieve the client currency, that you past as action inside the functions.php file of your theme.

This example uses a related code but its a bit simpler and just adds the parameter to the link. It goes at the end of your active theme's functions.php:

add_action( 'wcml_client_currency', 'currency' );
function currency( $current_currency ) {
    $currency = isset( $_GET['currency'] ) ? esc_attr( $_GET['currency'] ) : $current_currency;
    return strtoupper( $currency );

You then add this parameter ?currency=gbp to the link, like in you should be able to redirect directly to the GPB currency.

You will find a list of WooCommerce Multilingual Hooks here:

Please keep in mind that this kind of customization is on your own risk and responsibility, as custom coding goes beyond the standard WPML support policy.

You can try code examples that you find in our forums, but that may not work if there have been software and plugins updates (WooCommerce, Themes, WPML, WordPress) after the snippets were provided.

If you get problems with blank admin pages you may want to check the debug.log to see if that is due to a js-conflict, to a php problem (could be a compatibility issue with another plugin) or some access & permission issue.

Kind regards,

The topic ‘[Closed] WPML Currency URL Parameter’ is closed to new replies.