SHARE
TWEET

Aelia Currency Switcher - Reset country on change of address

businessdad Jul 18th, 2019 (edited) 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * PROTOTYPE
  3.  * Removes the cookie with the selected country when the user changes an address on the My Account
  4.  * page. This should trigger the "refresh" of the country and currency in the Currency Switcher,
  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('woocommerce_customer_save_address', function($user_id, $load_address) {
  21.     if(class_exists('\Aelia\WC\Aelia_SessionManager')) {
  22.         \Aelia\WC\Aelia_SessionManager::set_cookie('aelia_customer_country', '');
  23.         unset($_COOKIE['aelia_customer_country']);
  24.      }
  25. }, 15, 2);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top