Guest User

Untitled

a guest
May 20th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. function country_based_tax(){
  2.  
  3. // Geolocation must be enabled under Woocommerce > Settings > General > Default customer address
  4.  
  5. // IP geolocation
  6. $location = WC_Geolocation::geolocate_ip();
  7.  
  8. //Get country code
  9. $country = $location['country'];
  10.  
  11. // Disable woocommerce_adjust_non_base_location_prices for CH country code
  12. if($country == 'CH') {
  13. add_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false' );
  14. }
  15. }
  16.  
  17. add_action( 'init', 'country_based_tax' );
Add Comment
Please, Sign In to add comment