SHOW:
|
|
- or go back to the newest paste.
1 | /** | |
2 | * PROTOTYPE | |
3 | - | * Removes the cookie with the selected country when the user logs in. This should trigger the "refresh" |
3 | + | * Removes the cookie with the selected country when the user changes an address on the My Account |
4 | - | * of the country and currency in the Currency Switcher, when the "force currency by country" option |
4 | + | * page. This should trigger the "refresh" of the country and currency in the Currency Switcher, |
5 | - | * is enabled. |
5 | + | * when the "force currency by country" option is enabled. |
6 | * | |
7 | * DISCLAIMER | |
8 | * Aelia and any member of its staff are not responsible for any data loss or damage incurred | |
9 | * when using the code, which you can use at your own risk. | |
10 | * | |
11 | * GPL DISCLAIMER | |
12 | * Because this code program is free of charge, there is no warranty for it, to the extent permitted by applicable law. | |
13 | * Except when otherwise stated in writing the copyright holders and/or other parties provide the program "as is" | |
14 | * without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of | |
15 | * merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program | |
16 | * is with you. should the program prove defective, you assume the cost of all necessary servicing, repair or correction. | |
17 | * | |
18 | * Need a consultation, or assistance to customise this code? Find us on Codeable: https://aelia.co/hire_us | |
19 | */ | |
20 | - | add_action('wp_login', function($user_login, $user) { |
20 | + | add_action('woocommerce_customer_save_address', function($user_id, $load_address) { |
21 | - | if(class_exists('\Aelia\WC\Aelia_SessionManager')) { |
21 | + | if(class_exists('\Aelia\WC\Aelia_SessionManager')) { |
22 | - | \Aelia\WC\Aelia_SessionManager::set_cookie('aelia_customer_country', ''); |
22 | + | \Aelia\WC\Aelia_SessionManager::set_cookie('aelia_customer_country', ''); |
23 | - | unset($_COOKIE['aelia_customer_country']); |
23 | + | unset($_COOKIE['aelia_customer_country']); |
24 | - | } |
24 | + | } |
25 | }, 15, 2); |