Updated 16 September 2026
What is it?
By default, a valid VAT number from your own country still pays VAT; only VAT numbers from the other EU countries get the reverse charge. Some businesses need the reverse charge for their own country as well. You can switch that on with a small piece of code.
How to use it?
The VAT is calculated in two places: in the form while your customer fills it in, and on your server after submitting. So the code has two parts, one for each. Copy the below code to the functions.php of your child theme or to your snippet plugin, and change 2 into the ID of your form.
<?php
class GOTREU_Enable_Default_Country_Reverse_Charge {
private $_args;
public function __construct( $args = array() ) {
$this->_args = wp_parse_args( $args, array(
'form_ids' => array(), // An array of form IDs.
) );
if ( empty( $this->_args['form_ids'] ) ) {
return;
}
// The server: the VAT that is saved and charged after submitting.
foreach ( $this->_args['form_ids'] as $form_id ) {
add_filter( 'gotreu_default_country_reverse_charge_' . absint( $form_id ), '__return_false' );
}
// The form in the browser: the message and the VAT your customer sees.
add_action( 'wp_footer', array( $this, 'register_init_script' ), 99 );
}
public function register_init_script() {
$form_ids_json = wp_json_encode( array_map( 'strval', $this->_args['form_ids'] ) );
?>
<script type="text/javascript">
if ( typeof gform !== 'undefined' ) {
gform.addFilter( 'gotreu_default_country_reverse_charge', function( isDefaultCountry, formId ) {
var targetFormIds = <?php echo $form_ids_json; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>;
return targetFormIds.indexOf( String( formId ) ) !== -1 ? false : isDefaultCountry;
} );
}
</script>
<?php
}
}
// Required Configuration
new GOTREU_Enable_Default_Country_Reverse_Charge( array(
'form_ids' => array( 2, 6 ), // Enter the IDs of your forms, for example array( 1, 2, 3 ).
) );
For all your forms, use gotreu_default_country_reverse_charge without the _2 in the first part, and let the JavaScript function simply return false;.
All details are in the developer docs: gotreu_default_country_reverse_charge and gotreu_default_country_reverse_charge [JS].
Didn’t find what you were looking for?
Or contact support and I will help you out.
