Skip to content
AE DIGITAL
E-commerceBy 7 min read

Tax code, VAT number and SDI code in Shopify checkout: how to collect them

Which tax details to request in Shopify checkout from Italian consumers, businesses and public bodies, where to store them, how to validate them and pass them to invoicing.

Article cover: the word “SDI” next to a glowing icon on a violet space background

Why tax details belong in the checkout

If your Shopify store sells to Italian businesses and professionals, the moment you collect the VAT number in Shopify checkout decides whether the invoice goes out on its own or whether someone has to email the customer for missing details. Neither the invoicing software nor SDI, Italy's e-invoicing exchange system, can fix an incomplete order: a wrong VAT number or a missing recipient code blocks the document or forces you to reissue it.

Asking for these details by email after the purchase works while orders are few. Past a few dozen a month it becomes a standing chore: reminders, partial replies, late invoices. Checkout is the only moment when the customer is already paying and has a concrete reason to fill in a form.

The broader picture on receipts, invoices and SDI submission is in the guide to Shopify e-invoicing in Italy. Here we cover the technical side: which fields to ask for, where to store them in Shopify and how to check them. Tax rules should be confirmed with your accountant, and nothing here is tax advice.

Fields needed for consumers, businesses and public bodies

The FatturaPA technical specifications published by the Italian Revenue Agency define the data an invoice needs. Turned into checkout fields, there are four cases.

Consumer asking for an invoice

The codice fiscale (tax code) is enough: 16 alphanumeric characters for individuals. No recipient code is needed: the invoice is issued with 0000000 and the customer finds it in their reserved area. Consumers who don't want an invoice should not see any required field.

Business or professional

You need the company name, the partita IVA (VAT number, 11 digits for Italian entities), the tax code if different, and the delivery channel: a 7-character recipient code or a PEC (certified email) address. According to the specifications, the PEC is filled in only when the recipient code is 0000000, and the same value is used when the channel is unknown.

Public administration

The recipient code has 6 characters and matches the office code published on IndicePA. If you also sell to public bodies, make sure the field accepts 6 characters: a strict 7-character rule would reject them.

Foreign businesses

An EU customer needs a VAT number with the country prefix. For non-resident customers the specifications set the recipient code to XXXXXXX, which invoicing software usually applies automatically based on the country.

Options in Shopify for collecting tax data

Shopify checkout can't be edited like a theme: fields are added only through tools the platform provides. There are four workable routes.

Native localized fields

For some countries Shopify handles extra fields called localized fields. For Italy the Admin API lists the keys TAX_CREDENTIAL_IT and TAX_EMAIL_IT, a tax credential and a PEC address, and orders expose them under localizedFields. The upside is structured data. The downside is limited control over required status and format: test on a development store how they appear and what happens when a customer leaves them blank.

Shopify App Store apps

Some apps built for the Italian market make tax fields required or check their format. Before installing one, check where it stores the value (attribute, metafield or localized field), whether it works with express payments and whether it fits the invoicing tool you use.

Checkout UI extensions

With Checkout Extensibility extensions you can build a block with your own fields, save them as cart attributes or metafields and stop the buyer from continuing when values are invalid. Shopify's documentation states that extensions on the information, shipping and payment steps are available only on Shopify Plus.

Cart page attributes

On non-Plus plans you can add fields to the theme's cart page, saved as order attributes. It works, but a customer who pays with an express button on the product page skips the cart and the fields stay empty.

Validating VAT number, tax code and SDI code

An unchecked field collects typos, spaces, dots and codes pasted twice. The useful checks are few and all run before payment:

  • Italian VAT number: exactly 11 digits after removing spaces and the IT prefix. The last digit is a check digit computed from the first ten, so a typo is caught without any external call.
  • Personal tax code: 16 characters, the last one a check character. Accept letters in numeric positions too, because homocode cases replace some digits with letters.
  • Recipient code: 7 alphanumeric characters, or 6 if you serve public bodies. Convert to uppercase.
  • EU VAT number: a format check is not enough. The European Commission's VIES service checks whether the number is registered for intra-EU transactions, and the Commission recommends keeping a record of each check.

On Plus, blocking is done with the extension's block_progress capability or a Cart and Checkout Validation function, which according to the documentation also applies to express checkouts such as Shop Pay and Apple Pay.

Optional fields without losing conversions

Every extra required field weighs on every customer, including those who don't want an invoice. The cleanest approach is an explicit choice, such as an "I need an invoice" checkbox or a consumer versus business toggle, that shows the fields only to people who must fill them in.

Be careful with the company name. In Settings > Checkout the company field can be set to don't include, optional or required. Shopify's Help Center warns that making it required hides some express options such as Apple Pay. For a mixed B2C and B2B store, keep it optional and require the VAT number only when the customer picks the business profile. For more on express payments, see the article on which payment methods to offer in Italy.

Passing the data to invoicing software or SDI

Collected data is only useful if it reaches your invoicing tool without manual steps. Before choosing where to store it, check what your connector reads:

  1. Native connector of the invoicing tool: it often reads specific fields, for example an attribute with a fixed name. Match your key to what it expects, not the other way round.
  2. Make or similar automation: it reads attributes, metafields and localized fields through the API. That's the approach in the guide on connecting Shopify to Fatture in Cloud with Make, where a router separates businesses, consumers asking for an invoice and consumers who don't.
  3. Manual export: acceptable only at low volume, and only if field names are stable.

Use one key per value (partita_iva, codice_fiscale, codice_destinatario, pec) and don't concatenate everything into one string. When you change app or invoicing tool, separate fields migrate in an hour; a free-text note has to be reread order by order.

Tests and edge cases before going live

Before enabling the fields on the live store, test these cases on an unpublished theme or a development store:

  • consumer with no invoice: no required field visible;
  • consumer with invoice and a homocode tax code;
  • business with a recipient code and business with PEC only;
  • public body with a 6-character office code;
  • EU business whose VAT number is not active on VIES;
  • order paid with Apple Pay or Shop Pay straight from the product page;
  • order created manually in the admin or as a draft, which never goes through checkout.

For each test, check the order in the admin, the payload your connector reads and the generated document. After launch, track two numbers: the share of business orders with complete data and the number of invoices corrected each month. If the second doesn't drop close to zero, some path is still skipping the checks.

If you want fields, validation and the invoicing link set up as one project, it's part of our Shopify store setup service.

Frequently asked questions

Does Shopify have a native field for the Italian tax code?

For Italian addresses Shopify handles localized fields for a tax credential and a PEC address, readable on the order through the API. Configuration options are limited: making them required or validating their format usually needs an app or an extension.

How long is the SDI recipient code?

Seven characters for private recipients, meaning businesses and professionals. Six characters for public administration, where it matches the office code published on IndicePA.

What if the customer has no recipient code?

If they receive invoices by PEC, use 0000000 and fill in the PEC address. If the channel is unknown, 0000000 is still used: the invoice stays available in the customer's reserved area on the Italian Revenue Agency portal.

Do I need Shopify Plus to ask for a VAT number?

No. Without Plus you can use localized fields, a Shopify App Store app or attributes collected on the cart page. Plus is needed to add your own extensions to the information, shipping and payment steps.

Sources

  1. Specifiche tecniche del formato FatturaPA versione 1.4 — Agenzia delle Entrate - FatturaPA
  2. Editing the checkout form options — Shopify Help Center
  3. Checkout UI extensions — Shopify
  4. LocalizedFieldKey enum — Shopify
  5. Cart and Checkout Validation Function API — Shopify
  6. Check a VAT number (VIES) — Your Europe - European Union

Related articles

Tell us what isn't working.

We reply within one business day with a first opinion and, if it makes sense, a quote.

Write to us