This snippet is made for the EU VAT for Gravity Forms. It can apply the tax rate of the default country to all other EU countries.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Snippet to apply the tax rate of the base country to ALL EU countries | |
* | |
* @param Int $rate | |
* @param string $country_code the 2 digit ISO code of the country * | |
* @return Int $rate | |
* @version 1.0 | |
* @link https://geekontheroad.com/eu-vat-for-gravity-forms/ | |
* @author Johan dhollander | |
* | |
* | |
* INSTRUCTIONS | |
* 1. Copy this whole snippet excluding the beginning <?php tag | |
* 2. Change the " 1 " in the below line to your form ID or remove " _1 " to apply to all forms | |
**/ | |
add_filter("gotreu_standard_vat_rate_1" , "gotreu_default_to_base_country_vat", 10,2); | |
function gotreu_default_to_base_country_vat( $rate , $country_code) { | |
$class = gotrgf_euvat_addon(); | |
$settings = $class->get_plugin_settings(); | |
$base_country = $settings["eu_vat_default_country"]; | |
$explode = explode(":",$base_country); | |
$rate = intval($explode[1]); | |
return $rate; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment