Skip to content

B2B Checkout Mode

B2B mode adds business-specific fields to the checkout form: company name, VAT number with real-time validation, purchase order (PO) number, and configurable payment terms. All collected data is stored as order meta in WooCommerce.

Pass b2b: true when creating a session:

Terminal window
curl -X POST https://api.swft.co.uk/v1/sessions \
-H "Authorization: Bearer $SWFT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"cart": {
"b2b": true,
"lineItems": [...]
}
}'

You can also enable it globally for a merchant so every session defaults to B2B mode:

Terminal window
curl -X PATCH https://api.swft.co.uk/v1/merchants/{id} \
-H "Authorization: Bearer $SWFT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"defaults": {"b2b": true}}'
FieldRequiredNotes
Company nameYesStored as _billing_company on the order
VAT numberNoValidated in real time; stored as _swft_vat_number
PO numberNoFree text; stored as _swft_po_number
Payment termsNoShown if paymentTerms options are configured

Replaces the standard “First name / Last name” row with “Company name” plus a condensed name row beneath it. The contact name is still collected for order fulfilment purposes.

The VAT field appears below the company name. As the shopper types, Swft validates the number format client-side using a country-code prefix regex before triggering a live lookup.

Swft validates VAT numbers against two authoritative sources depending on the country prefix:

EU member states — validated via the VIES SOAP API. A valid VIES response returns the registered business name, which is shown to the shopper as confirmation. If VIES is temporarily unavailable (it has planned downtime windows), validation is skipped and the number is accepted with a warning flag stored on the order.

GB (post-Brexit) — validated via the HMRC VAT number API. The same confirmation name display applies.

Other countries — format validation only (no live lookup). The number is stored as entered.

When a valid VAT number is confirmed, the checkout automatically removes VAT from the order total if the merchant’s WooCommerce store has the “EU VAT Assistant” or “WooCommerce EU VAT Number” plugin installed and configured for zero-rating B2B sales. This is handled via the swft_session_tax_override filter.

add_filter( 'swft_session_tax_override', function( $tax, $session ) {
if ( $session['b2b']['vatValid'] && $session['b2b']['vatCountry'] !== 'GB' ) {
return 0; // zero-rate validated EU business customers
}
return $tax;
}, 10, 2 );

An optional free-text field for the customer’s internal purchase order reference. Stored as _swft_po_number on the WooCommerce order and displayed in the order confirmation email if the swft_order_email_po_number filter returns true.

Configure available terms in the merchant config:

{
"b2b": {
"paymentTerms": [
{ "label": "Pay now", "value": "immediate", "default": true },
{ "label": "Net 14", "value": "net14" },
{ "label": "Net 30", "value": "net30" }
]
}
}

When paymentTerms is configured, a selector appears in the checkout. Selecting a deferred term (anything other than immediate) skips the card step and places the order with the WooCommerce status on-hold. Your accounts team or an automation (e.g. WooCommerce Subscriptions, Xero integration) is then responsible for collecting payment.

The selected term is stored as _swft_payment_terms on the order.

A completed B2B order carries the following additional meta:

Meta keyValue
_billing_companyCompany name as entered
_swft_vat_numberVAT number string
_swft_vat_valid1 if VIES/HMRC confirmed, 0 otherwise
_swft_vat_countryISO 3166-1 alpha-2 country code of the VAT number
_swft_vat_nameRegistered business name returned by VIES/HMRC
_swft_po_numberPurchase order reference
_swft_payment_termsSelected payment terms value