businessdad

Aelia Currency Switcher - Reset country on login

Apr 4th, 2019 (edited)
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. /**
  2.  * PROTOTYPE
  3.  * Removes the cookie with the selected country when the user logs in. This should trigger the "refresh"
  4.  * of the country and currency in the Currency Switcher, when the "force currency by country" option
  5.  * 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) {
  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);
Add Comment
Please, Sign In to add comment