gotreu JavaScript API [JS]

Updated 15 September 2026

On this page

Description

The window.gotreu object holds the VAT data of every EU VAT form on the page. Use it in your own code to read the VAT rate or the VIES result of a form, or to recalculate the VAT after you changed something with code.

Use these functions instead of the older globals window.gotreu_tax_rate and window.gotreuTaxInfo. Those still exist, but they only hold the value of the form that changed last.

Parameters

gotreu.getRate( formId ) | The VAT rate that applies to the form right now

gotreu.getSetting( formId, key ) | A setting of the EU VAT field of the form: prices_include_vat (true or false), default_tax_country or default_tax_percentage

gotreu.getTaxInfo( formId ) | The VIES result of a validated VAT number (company_name, company_address, country_code, full_vat_number, valid, …), or null

gotreu.isHidden( formId ) | Whether the EU VAT field is hidden, for example for a customer outside the EU

gotreu.refreshTotals( formId ) | Recalculates the totals and the VAT of the form. Returns a Promise

gotreu.getProductTotal( formId, productId ) | The total of one product: (price + option prices) × quantity

gotreu.getShippingPrice( formId ) | The shipping costs of the form

Usage

Example: change a price with code, recalculate the VAT and show the rate of form 3 in the browser console.

<script type="text/javascript">
jQuery( '#input_3_5' ).val( '25' ).trigger( 'change' );
window.gotreu.refreshTotals( 3 ).then( function() {
    console.log( 'VAT rate of form 3: ' + window.gotreu.getRate( 3 ) + '%' );
} );
</script>

Since

version 1.1.0

Didn’t find what you were looking for?

Or contact support and I will help you out.

Scroll to Top