Skip to content

Instantly share code, notes, and snippets.

@geekontheroad
Created June 5, 2024 07:43
Show Gist options
  • Save geekontheroad/64ce7acd20f5fcd88135f6ece2a3e514 to your computer and use it in GitHub Desktop.
Save geekontheroad/64ce7acd20f5fcd88135f6ece2a3e514 to your computer and use it in GitHub Desktop.
<?php
/**
* This is an example of how to change the default tax rate of a country
* This snippet is meant for the EU VAT for Gravity forms add-on
*
* @author Johan d'Hollander
* @link https://geekontheroad.com/eu-vat-for-gravity-forms/
**/
add_filter( 'gotreu_standard_vat_rate', 'example_change_vat_rate', 10, 2 );
/**
* Change the standard VAT rate for a specific country.
*
* @param float $vat_rate The standard VAT rate.
* @param string $country_code The country code.
* @return float The new VAT rate.
*/
function example_change_vat_rate( $vat_rate, $country_code ) {
// Change the rate for the Netherlands to 19%
if ( $country_code == 'NL' ) {
return 19;
}
return $vat_rate;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment