Exclude country based tax calculation
Prevent taxes from being calculated based on the customer's country.
add_filter('advanced_woo_discount_rules_get_price_including_tax', function($price, $product, $original_price){
$post_data = $_POST['post_data'];
$post = array();
if (!empty($post_data)) {
parse_str($post_data, $post);
}
$shipping_country = isset($_POST['calc_shipping_country']) ? $_POST['calc_shipping_country'] : null;
if (empty($shipping_country) || is_null($shipping_country)) {
$shipping_country = isset($_POST['s_country']) ? $_POST['s_country'] : null;
if (empty($shipping_country) || is_null($shipping_country)) {
if (isset($post['shipping_country']) && !empty($post['shipping_country'])) {
$shipping_country = $post['shipping_country'];
} else {
if(class_exists('\Wdr\App\Helpers\Woocommerce')){
$shipping_country = Wdr\App\Helpers\Woocommerce::getShippingCountry();
}
}
}
}
if(!is_array($shipping_country) && $shipping_country == 'DE'){
return $original_price;
}
return $price;
}, 10, 3);