Use params on URL

Instead of having to change currencies by choosing from a dropdown list, you can change them on the URL by changing the currency code.

eg: {your-site-url}.com/?yay-currency=EUR. You can convert to USD currency by replacing EUR with USD.

To do this, you can add the following code to Code Snippets or to the file functions.php of your store theme.

It is recommended to add it tofunctions.php of child theme so that it will be preserved when you update the theme.

add_filter('yay_currency_use_params', 'yay_currency_use_params', 10,1);
function yay_currency_use_params( $use_param ) {
    return true;
}

In case you don't want to use this parameter: ?yay-currency. You can use this hook to rename it: yay_currency_param_name

add_filter( 'yay_currency_param_name',  'custom_yay_currency_param_name' );
function custom_yay_currency_param_name( $param_name ) {
   $param_name = 'your_change';
   return $param_name;
}

Last updated