Last active
May 20, 2019 09:53
-
-
Save kilbot/a87d0246d95fc5c93cbf27476c2ca453 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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