Change WooCommerce currency programmatically on AJAX request

This is how I solved it: /** * Force currency change */ add_filter( ‘wcml_client_currency’, function($current) { if(isset($_GET[‘currency’]) && $_GET[‘currency’]) return $_GET[‘currency’]; if(isset($_POST[‘currency’]) && $_POST[‘currency’]) return $_POST[‘currency’]; return $current; } ); And then in order for the above filter to be listened to, it’s important that you have added below code: add_action( ‘wp_ajax_quick_view_single_product’, __NAMESPACE__ . ‘\\quick_view_single_product’ … Read more

How to change the canonical link from a category or taxonomy archive?

I found the solution by myself: function yoast_seo_canonical_change_archives( $canonical ) { if ( is_tax( ‘tourist-spots’ ) ) { $path = parse_url( $canonical, PHP_URL_PATH ); return ‘https://www.luxuryvillasphuketthailand.com’ . $path; } return $canonical; } add_filter( ‘wpseo_canonical’, ‘yoast_seo_canonical_change_archives’, 10, 1 );

Translate string inside twig template

I managed to assign a variable to context. $context = Timber::get_context(); $context[‘search_placeholder’] = __(“Suche”,”pixel_framework”); Timber::fetch(‘test.twig’,$context); inside twig <input type=”text” id=”s” name=”s” value=”” placeholder=” {{search_placeholder}}”>

append currency to URL

Thanks to @mozboz I figured out the answer to my question. I am posting it here in case it helps somebody else: WordPress (WPML plugin for multi-language and multi-currency) uses the cookie _wcml_dashboard_currency. I was able to set a cookie with the following code and that handled my problem with the currency selection changing after … Read more