Skip to content

Instantly share code, notes, and snippets.

@kilbot
Last active May 20, 2019 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kilbot/a87d0246d95fc5c93cbf27476c2ca453 to your computer and use it in GitHub Desktop.
Save kilbot/a87d0246d95fc5c93cbf27476c2ca453 to your computer and use it in GitHub Desktop.
<?php
// the code below goes in your theme's functions.php file
function my_custom_pos_template_redirect() {
$usd_store_id = 3365;
$cad_store_id = 3366;
$current_store_id = get_user_option('woocommerce_pos_store');
if($current_store_id == $usd_store_id) {
wc_setcookie( 'wcumcs_user_currency_cookie', 'USD', time() + 7776000 );
}
if($current_store_id == $cad_store_id) {
wc_setcookie( 'wcumcs_user_currency_cookie', 'CAD', time() + 7776000 );
}
}
// woocommerce_pos_template_redirect runs just before the POS template is rendered
add_action( 'woocommerce_pos_template_redirect', 'my_custom_pos_template_redirect', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment