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' );
add_action( 'wp_ajax_nopriv_quick_view_single_product', __NAMESPACE__ . '\\quick_view_single_product' );
function quick_view_single_product() {
wc_get_template('modal-single-product.php');
die();
}
/**
* Ensure WCML's currency filters are listened to
*/
add_filter( 'wcml_multi_currency_ajax_actions', 'add_action_to_multi_currency_ajax', 10, 1 );
function add_action_to_multi_currency_ajax( $ajax_actions ) {
$ajax_actions[] = "quick_view_single_product"; // Add a AJAX action to the array.
return $ajax_actions;
}