Skip to content

B2B checkout fields

Polski for WooCommerce adds B2B fields to the WooCommerce checkout for shops that sell to companies: a "Buying as a company" checkbox, an optional "I need a VAT invoice" checkbox, and optional REGON and IBAN fields. The NIP field comes from the separate NIP module. Values go to standard order meta, where the KSeF and invoice modules read them.

There is no switch for these fields in Polski > Modules. They are controlled by the polski_b2b option, and with the defaults only the "Buying as a company" checkbox is shown.

Checkbox polski_buying_as_company placed in the billing section (priority 25, before the company name). Unchecked by default: the REGON and IBAN rows are hidden until the customer ticks it. The toggle state is saved to order meta _polski_buying_as_company (yes / no) and shown on the order screen below the billing address.

The show/hide logic is inline JavaScript loaded on the checkout page only, with no build pipeline or extra frontend dependency. The script also listens for the jQuery updated_checkout event, so it keeps working after WooCommerce refreshes the classic checkout.

The toggle is a classic checkout field. The block checkout can ask instead, from Polski 1.50.0: tick Ask "Buying as: Personal / Company" on the block checkout in the settings of the NIP module (NIP - Verification and Autocomplete). It is off by default and works while the "Buying as a company" toggle is on (show_company_toggle, the default). A required "Buying as" choice (polski/buyer_type) then sits under the e-mail address. Company shows a required "Company name" field (polski/company_name) and the NIP field, which is required only when "NIP required on checkout" is on; Personal hides both. The answer is saved to _polski_buying_as_company like the classic toggle, the company name goes to the order's billing company, and a personal order drops any company name or NIP that was typed. Set WooCommerce's own Company field to Hidden in the Checkout block, or the form asks for the company twice.

Checkbox polski_needs_invoice, off by default (show_needs_invoice_toggle). When enabled, the answer is saved to order meta _polski_needs_invoice (yes / no). On the block checkout it appears in the order information section as polski/needs_invoice.

The NIP field (billing_nip) is added by the NIP module, not by these B2B settings. That module checks the Polish NIP checksum (10 digits, weights 6, 5, 7, 2, 3, 4, 5, 6, 7, modulo 11) and saves the digits under _billing_nip and _polski_billing_nip order meta. The nip key in polski_b2b is not read by any code.

For your own code, the plugin ships a static helper, Polski\Util\NipValidator:

use Polski\Util\NipValidator;
NipValidator::isValid('5260250274'); // true
NipValidator::isValid('PL 526-025-02-74'); // true
NipValidator::normalize('PL 526-025-02-74'); // '5260250274'
NipValidator::format('5260250274'); // '526-025-02-74'

Optional billing_regon field (off by default), placeholder "9 or 14 digits". Spaces are removed, then the value must have 9 or 14 digits (short / long REGON): /^\d{9}$|^\d{14}$/. An empty field passes. Saved to _billing_regon order meta.

Optional billing_iban field (off by default). Spaces are removed and letters upper-cased, then the module checks:

  1. a 2-letter country prefix, 2 check digits and 11 to 30 alphanumeric characters, 15 to 34 in total
  2. the exact length for the country, for 30 European countries including PL (28), DE (22) and GB (22); other prefixes skip this step
  3. the ISO 13616 mod-97 checksum

A failed check shows "The IBAN is invalid. Check the country code, length, and check digits." An empty field passes. Saved to _billing_iban order meta.

Key Default Description
enabled true Master switch for all B2B fields
show_company_toggle true Whether to show the "Buying as a company" checkbox
show_needs_invoice_toggle false Whether to show the "I need a VAT invoice" checkbox
nip true Not used; the NIP field belongs to the NIP module
regon false Whether to add the REGON field
iban false Whether to add the IBAN field

Enable REGON and IBAN via update_option:

update_option('polski_b2b', array_merge(
(array) get_option('polski_b2b', []),
['regon' => true, 'iban' => true]
));
  • KSeF module (FREE) reads _billing_nip from the order and automatically detects orders that require an e-invoice.
  • Invoice module reads _billing_nip as the buyer's NIP when building an invoice.
  • AI Feed for invoices (PRO) exposes invoices as Markdown with the buyer's NIP in the "Parties" block.

REGON and IBAN are added to the "Billing details" block on the order screen (woocommerce_admin_billing_fields), so they are edited in the same place as the customer's billing address. The "Buying as a company" answer is printed below the billing address.

On WooCommerce 8.6 and newer, the module also registers REGON, IBAN and the invoice toggle through the woocommerce_register_additional_checkout_field API, with the same validation. The classic checkout keeps its own registration through woocommerce_billing_fields, because WooCommerce does not render additional address fields on the shortcode checkout.

Field Classic checkout Block checkout
Buying as a company Yes Optional "Buying as" choice, polski/buyer_type (contact field), see above
I need a VAT invoice Yes Yes, polski/needs_invoice (order field)
REGON Yes Yes, polski/regon (address field)
IBAN Yes Yes, polski/iban (address field)

The WC API stores its own copies of the values. Polski mirrors the billing copies to the legacy keys _billing_regon, _billing_iban and _polski_needs_invoice (woocommerce_set_additional_field_value action), so the KSeF and invoice modules read the same keys from both checkouts.

Where does the NIP field come from?

Section titled "Where does the NIP field come from?"

From the NIP module (Polski > Modules), which is off by default. The B2B settings described here add the company toggle, the VAT invoice toggle, REGON and IBAN only.

How do I show the REGON and IBAN fields?

Section titled "How do I show the REGON and IBAN fields?"

Set regon and iban to true in the polski_b2b option, as in the snippet above. Both fields are optional for the customer, and on the classic checkout they stay hidden until "Buying as a company" is ticked.

Does the IBAN field check the account number checksum?

Section titled "Does the IBAN field check the account number checksum?"

Yes. Besides the format and the country length, the value must pass the ISO 13616 mod-97 check.