less than a minute read • Updated 44 minutes ago
Exempt Customers with a Tax ID
How to let customers with a valid tax ID check out without a given tax, including enabling the option, adding the field, and prepopulating it.
Overview
You can let qualifying customers (often businesses with a tax ID) check out without a given tax. When a customer checks out with a non-empty tax ID, Foxy removes the taxes that have this option enabled.
Enable the exemption per tax
Add the tax ID field to checkout
Go to Settings > Checkout. In the checkout fields, set Tax ID to Optional or Required (it is Hidden by default). Each field uses a Hidden, Optional, or Required dropdown.
Prepopulate the tax ID
Because the tax ID can belong to the billing or shipping address, there are two fields: shipping_tax_id and billing_tax_id. You can prepopulate them by calling the cart with the values. To run this on your own page, wrap it so it executes after Foxy initializes:
const FC = FC || {};
const existingOnLoad = (typeof FC.onLoad == 'function') ? FC.onLoad : function () {};
FC.onLoad = function () {
existingOnLoad();
FC.client.on('ready.done', function () {
const customerTaxId = 'CUSTOMER_TAX_ID';
FC.client.request(
'https://' + FC.settings.storedomain +
'/cart?shipping_tax_id=' + customerTaxId +
'&billing_tax_id=' + customerTaxId
);
});
};Notes
You can also set the value through the API. Even if the field is hidden on checkout, a customer with a tax ID is treated as exempt, so you could keep it hidden and apply approved tax IDs yourself after your own validation.
Foxy does not validate the tax ID number.