E-commerce14 min read•

Collecting Business Details and GSTIN at Checkout on Your Shopify Store: Fields, Validation, Invoice Download and Order Emails

How to capture company name and GSTIN on a Shopify store, validate it, store it with the order, and show it in emails and customer accounts, with WooCommerce notes.

#Shopify#GSTIN#Checkout#WooCommerce#Ecommerce development Pune

Collecting Business Details and GSTIN at Checkout on Your Shopify Store: Fields, Validation, Invoice Download and Order Emails

To collect business details at checkout on a Shopify store, add a clear "buying for a business" choice, ask for the company name and GSTIN only when that choice is selected, validate the format on the page, check that the GSTIN's state matches the delivery or billing state, save the values against the order (and optionally the customer), and then print them in the order confirmation email and the customer's order page. How much of that you can build depends on your Shopify plan: on non-Plus plans you are limited to the checkout and accounts editor, apps, and the order status and customer account pages, while Plus stores can add extensions to the information, shipping and payment steps. This guide covers the build for ecommerce website development in Pune and anywhere else in India: what the storefront should capture, how to store it, where it should appear, what the platform allows, and how to test it.

This replaces an earlier version of this article that mixed tax explanation with store setup. Tax rates, registration, filing and which invoices a seller must issue are matters for the seller's chartered accountant, and this article does not cover them. It covers only the website: the fields, the data and the documents your customer can see.

Decide what the store must capture

Before opening the theme editor, agree on the data with your accountant and whoever prepares invoices. The website should collect what that person needs, no more. A typical set looks like this.

Field Required when Where it is stored Notes
Purchase type (personal or business) Always shown Order attribute Defaults to personal so most shoppers see nothing extra
Company name Business selected Order attribute, billing company Shopify addresses already have a company line
GSTIN Business selected Order attribute or metafield Optional by design unless your accountant says otherwise
Billing state Always Billing address province Used for the consistency check
Contact for invoice Optional Order attribute If accounts payable differs from the buyer
Consent to save details Logged-in customers Customer metafield Lets returning buyers skip the fields

Two principles keep this clean. First, collect nothing from consumers that only a business needs. Second, treat the GSTIN as a customer-supplied value that your site checks for shape, not a fact your site has verified. Your site can tell that a value looks like a GSTIN. It cannot tell, by format alone, that the number is active or belongs to that company.

Ecommerce website development in Pune: designing the B2B and B2C toggle

The toggle is the part shoppers notice, so it deserves care. Our general guidance on field count and guest flows is in the checkout form and guest checkout guide; this section covers only what is specific to business details.

Keep the default path unchanged

Most orders on a consumer store come from individuals. A required extra field costs conversions, so the business option should be a single, low-key choice such as a checkbox reading "I am buying for a business and want my GSTIN on the invoice". Unchecked, the checkout looks exactly as it did before.

What appears when it is checked

When the box is ticked, reveal two fields directly beneath it: company name and GSTIN. Do not send the shopper to another page. Keep the labels plain: "Company name" and "GSTIN (15 characters)". A short helper line such as "Example format: 27ABCDE1234F1Z5" is enough; do not use a real company's number as the example.

GSTIN format validation: what the page can and cannot check

A GSTIN is a 15-character identifier. The layout commonly described is: two digits for the state or union territory code, ten characters for the holder's PAN, one character for the entity number, the letter Z in the fourteenth position, and a final check character. For example, 27 is the code used for Maharashtra. Confirm the layout and the state code list on the official GST portal (gst.gov.in) before building validation rules; the layout above is taken from secondary guides, not from a page we could open on the portal.

A format check you can run in the browser

A pattern check catches most typing slips. In plain words, the value should be 15 characters, uppercase letters and digits, with two digits first, then the PAN shape of five letters, four digits and one letter, then one character for the entity number, then Z, then one final character. A regular expression for that shape looks like this:

^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]$

Treat this as a starting point and confirm the exact pattern with your accountant, because registration categories can differ. Whatever you use, normalise the input first: trim spaces and convert to uppercase before testing, so that "27abcde1234f1z5 " does not fail for cosmetic reasons.

Server-side validation matters as much as the page

Any check that runs only in the browser can be bypassed or can fail silently. Run the same rule again where the data is saved. On Shopify that usually means a check inside the extension before it lets the buyer continue, plus a second check when your back end or an order-created automation reads the stored value.

Be honest in the error message

Write errors that help: "GSTIN should be 15 characters, for example 27ABCDE1234F1Z5. Please check and try again." Avoid "Invalid input". And decide what happens when the shopper is stuck: if you let them continue without a GSTIN, say that the invoice will then be issued without it. Whether you can do that is a question for your accountant, not the website.

Cross-check the state code against the address

The first two characters of the GSTIN carry a state code, which gives you a useful cross-check against the address the shopper entered.

Compare the GSTIN's state code with the billing address state. If the two disagree, show a gentle prompt: "This GSTIN appears to be registered in Maharashtra but your billing address is in Karnataka. Is that correct?" Let the shopper confirm. A business can have a GSTIN in one state and a billing address in another, and your site should not block that on its own.

What Shopify lets you build, by plan

This is where many projects go wrong, because older tutorials describe a customisation route that no longer exists. According to Shopify's developer documentation, the main current options are checkout UI extensions and Shopify Functions. Shopify states that checkout.liquid is no longer supported for the information, shipping and payment steps, and that it was sunset for the Thank you and Order status pages; the documentation gives script tag sunset dates of 28 August 2025 for Plus stores and 26 August 2026 for non-Plus stores, both of which have now passed. Read the current page rather than relying on this summary, as dates and details change.

Checkout UI extensions

These let an app add interface elements to checkout: banners, custom fields, client-side validation and similar. Merchants place the blocks using the checkout editor in the Shopify admin. For our purpose the relevant capabilities are:

  • Setting an order-level attribute with the attribute-change API, using a key and a value.
  • Writing cart metafields with the metafield-change API from checkout targets, while Thank you page targets can read them but cannot write.
  • Blocking the buyer from moving to the next step, using the block_progress capability, which is how an extension can stop a malformed GSTIN from going through.
  • Requesting any metafield your extension uses in its configuration file.

The plan limit

Shopify's help documentation says standard checkout customisations are available on all pages for stores on the Basic plan or higher, while apps that customise the information, shipping and payment steps, and the Checkout Branding API, are Plus features. The developer documentation says the same about extensions on those three steps: they are for Shopify Plus stores. So the full "field inside checkout with blocking validation" design is a Plus build. On other plans you need a different route.

Shopify Functions

Functions customise business logic on the server side: hiding or renaming payment and delivery options, server-side validation such as quantity limits, and discount types. Cart metafields can be read in a function's input query. They are useful when a rule must be enforced regardless of the browser, but they are not a way to add a visible field.

What to do on a non-Plus plan

Be straightforward with the client about the options:

  1. Use a cart page or product-level field. Capture the business toggle, company name and GSTIN in the theme's cart page or cart drawer, and save them as cart attributes before the shopper goes to checkout. This is a theme change and works on all plans, with the trade-off that the fields sit before checkout rather than inside it.
  2. Use the Thank you or Order status page. A post-purchase prompt, "Need a business invoice? Add your GSTIN", via an extension on those pages, which Shopify says are available to all plans through the checkout and accounts editor. The data is attached to an order that already exists.
  3. Use an app from the Shopify App Store that already handles this. Evaluate it on where it stores the data, whether it validates, whether it shows in emails, and what happens to the data if you uninstall it.
  4. Use Shopify's B2B features. Shopify's help page on companies describes a company profile with locations, and a Tax ID field in the Taxes section of a company location. This suits stores selling to a known list of business accounts rather than anonymous visitors. The page does not name which plans include B2B, so confirm that before you design around it.

Worked example (hypothetical)

A hypothetical Pune-based seller of office furniture on a non-Plus plan wants business buyers to add a GSTIN. The build: a tick box and two fields in the cart drawer, validated in the theme script; values saved as cart attributes; the same values copied to the order; and a Thank you page block for buyers who forgot. The seller's accountant confirms which field the invoice reads. No part of this depends on Plus, and nothing in it is a tax decision.

Storing the data and showing it in emails and customer accounts

How you store the value decides whether you can later use it in emails, exports and integrations.

Cart and order attributes

Attributes are simple key-value pairs attached to the cart, and they carry through to the order. Shopify's email variable reference lists attributes as "any attributes which were attached to the order", so a stored value is readable in notification templates. Use stable, lowercase keys such as buyer_type, company_name and gstin, and never rename them after launch.

Metafields

Metafields are namespace-and-key custom data on Shopify resources, such as customers and orders, and they need a definition before use. For customers you would save the business details here so they can be prefilled on the next visit. The metafield documentation describes access settings for the admin, the Storefront API and the Customer Accounts API, all hidden by default for the storefront and customer account APIs, so set them deliberately. A GSTIN is a business identifier and not a secret, but it still should not be exposed to anyone other than the account holder. Keep the default of no public storefront read unless you have a reason.

Showing the details in order emails

Shopify sends order confirmation emails from templates you can edit under Notifications in the admin. The templates use Liquid, and the variable reference page lists attributes, metafields (accessed as metafields.NAMESPACE.KEY) and billing_address.company. It also notes that in email templates the order object is not referenced by name, so you write the attribute directly rather than through an order prefix.

What to add

In the order confirmation, add a short block that shows only when a GSTIN exists: "Business details: company name, GSTIN". Wrap it in a condition so consumer orders show nothing. Keep the layout consistent with the rest of the template, and show the values exactly as the customer entered them, so they can spot an error straight away.

Letting customers see and download business documents

Customers who have accounts expect to find their orders and paperwork in one place.

What Shopify's customer account extensions support

Shopify's developer documentation describes customer account UI extensions with targets on the order index page, the order status page and the profile page, plus full-page extensions for new pages. They are supported only on the new version of customer accounts. If your store still uses legacy accounts, the extension route is unavailable, so check the version first.

Where the invoice itself comes from

This article does not cover what an invoice must contain; that is for your accountant and your invoicing tool. From a website point of view the question is only how the document reaches the customer: a link in the email, a link on the order page, or a PDF attachment. Our earlier piece on setting up GST invoices on Shopify discusses invoice generation tools; here we care that the stored GSTIN and company name actually reach whichever tool produces the document, and that the customer's download link works for the right person only. Links must be authenticated or hard to guess, and should not be shared across customers.

WooCommerce: the same job, briefly

WooCommerce has a native route now. The Checkout block supports an additional checkout fields API: you register a field with a namespace/name identifier, a label, a location, a type and options, and you can add required, hidden and validation rules. Per the WooCommerce developer documentation:

  • Contact-location fields save to the shopper's account and appear in Account details.
  • Address-location fields exist separately for shipping and billing.
  • Order-location fields save only to the order, not the customer profile.
  • Single-field validation uses a dedicated action that adds errors to an error object; multi-field checks within a location have their own hook, which suits the GSTIN-versus-state comparison.
  • Conditional logic, such as showing the GSTIN only when the business box is ticked, can use JSON Schema rules evaluated in the browser and again on the server.
  • Values are stored as meta on the order and customer under prefixed keys, and the documentation recommends the helper functions over reading meta directly.

The documentation we read does not describe how these fields appear in admin screens or emails, other than for dates, so test that yourself. If your store still uses the older shortcode checkout, the approach differs and needs a plugin or custom code. For a broader platform comparison, see Shopify vs WooCommerce for Indian D2C stores.

Testing checklist

Run these before launch and after any theme, app or checkout change. Use test orders, and never real customers' numbers.

Field behaviour

  • Business box unchecked: no extra fields, no extra attributes on the order.
  • Business box checked: both fields appear and are required only in that state.
  • Unticking after typing clears the values.
  • Lowercase input and trailing spaces are normalised.
  • Too short, too long and wrong-pattern values show a specific error.
  • A value with the right shape but the wrong state code triggers the soft state warning.

Data

  • The order in the admin shows the company name and GSTIN in the expected place.
  • The values survive payment, including a failed payment followed by a retry.
  • Discount codes, cart changes and address edits after entry do not drop the fields.
  • A logged-in customer's saved details prefill correctly and can be changed for one order.
  • An export or API read returns the values, so your invoicing tool receives them.

Emails and documents

  • The confirmation email shows the block only for business orders.
  • A consumer order's email is unchanged.
  • The order status page shows the details for guests and account holders.
  • The download link works for the right customer and fails for another.
  • Mobile layout of the email and order page is readable.

If you have a consistent testing routine, our checkout optimisation guide for Indian stores is a good companion for checking the wider flow.

Working with Govindani Infotech on business-details checkout for Shopify and WooCommerce

Govindani Infotech is a Pune-based web development company at 2nd Floor, Landmark Plaza, 206 Satara Road, Parvati Paytha, Pune 411009. We build websites and e-commerce stores, and the CRM and WhatsApp integrations that sit behind them. For a project like this, the first job is a short discovery: your Shopify or WooCommerce plan, whether accounts are on the new customer account version, which tool produces your invoices, and what your accountant needs on the document. From that we can say which of the routes above fits, and which are not available to you. See our ecommerce services and website creation pages, or ask for a quotation on WhatsApp at https://wa.me/919201958278 or through /contact-us.

Frequently Asked Questions

Can I add a GSTIN field to Shopify checkout?

Yes, but the route depends on your plan. Shopify's documentation says extensions that customise the information, shipping and payment steps are for Plus stores. On other plans you can add the field on the cart page or cart drawer, or collect it on the Thank you or Order status page, or use an app.

How do I validate a GSTIN in a form?

Normalise the input to uppercase without spaces, then check that it is 15 characters matching the usual layout of state code, PAN, entity character, Z and a check character. Run the check again on the server. A format match does not prove the number is active, and tax treatment of any order belongs to the seller's accountant.

Where is the GSTIN stored on a Shopify order?

If you capture it as an order or cart attribute, it is stored with the order and can be read in notification templates through the attributes variable. You can also save it in a customer or order metafield, which needs a definition first. Choose one convention and keep the keys stable.

Can the GSTIN appear in the order confirmation email?

Yes. Shopify's notification templates support Liquid, and the variable reference lists attributes, metafields and the billing company name. Add a conditional block so it only shows for business orders.

Does WooCommerce have a built-in way to add this field?

The Checkout block has an additional checkout fields API that lets developers register fields with a location, type, required rules and validation. Older shortcode checkouts need a plugin or custom code. Check how the values appear in admin and emails on your own setup.

Sources: Shopify.dev: Checkout customization, Shopify Help: Checkout and accounts editor, Shopify.dev: Checkout UI extensions API, Shopify.dev: Customer account extensions, Shopify.dev: Metafields, Shopify Help: Notification variables, Shopify Help: B2B companies, WooCommerce Developer Docs: Additional checkout fields

Need Help With Your Digital Strategy?

Govindani Infotech helps Indian businesses and NGOs build websites, run ads, and grow online. Contact us for a free consultation.