GraphQL Order API - Issues with Tax Exemption Field and Missing VAT ID

Hi

I’m working with the GraphQL Order API and have encountered two issues related to tax information:

1. Incorrect tax exemption status: When querying orders for tax-exempt customers, the order.taxExempt field returns false even though the customer has a valid tax ID and no tax was paid on the order. (example order id: 12380534047052)

2. Unable to retrieve customer VAT ID: I need to access the customer’s VAT ID that was used at the time of order placement, but I cannot find an appropriate field in the Order API response.

Thank you for your assistance.

Hi elgreco,

Based on the Order object definition in the Admin API (2026-01), here is some insight into the behavior you are seeing:

1. Regarding taxExempt returning false

The taxExempt field definition states:

“Whether taxes are exempt on the order. Returns true for orders where the customer or business has a valid tax exemption… Use this to understand if tax calculations were skipped during checkout.”

If this returns false, it means the order itself was not marked as explicitly exempt from tax calculation logic during checkout. Even if the customer has a Tax ID, Shopify often handles VAT/Tax exemptions (like EU Reverse Charge) by applying a 0% tax rate rather than setting the global taxExempt flag to true.

Recommendation:
Instead of relying solely on taxExempt, check the taxLines field.

  • taxLines: “A list of all tax lines applied to line items on the order… Tax line prices represent the total price for all tax lines with the same rate and title.”

If the customer provided a VAT ID, you will likely see taxExempt: false, but inside taxLines, you should see an entry with a rate of 0.0 (or similar), indicating that tax was calculated but resulted in zero due to the VAT ID.

2. Retrieving the Customer VAT ID

There is no direct top-level field for “VAT ID” or “Tax ID” on the Order object. However, based on the schema, you should check the following locations within the Order query:

A. customAttributes
This is the most common location for tax identifiers collected at checkout.

Description: “A list of additional information that has been attached to the order.”
Type: [Attribute!]

Query this field and look for a key such as “VAT Number”, “Tax ID”, or “VAT” (depending on your specific checkout configuration or region).

B. metafields
If your store uses a third-party tax app or custom fields to store this data, it will be found here.

Description: “A list of custom fields that a merchant associates with a Shopify resource.”

C. billingAddress
While the text provided doesn’t expand the MailingAddress object, the Order object contains a billingAddress field. In some regions, the VAT ID is stored as part of the address fields (often mapped to company or a specific address attribute).

Sample Query to Debug:

codeGraphql

query {
  order(id: "gid://shopify/Order/12380534047052") {
    taxExempt
    taxLines {
      title
      rate
      priceSet { shopMoney { amount } }
    }
    customAttributes {
      key
      value
    }
    billingAddress {
      company
      # specific VAT fields would be inside the Address object
    }
  }
}

Hope this helps clarify how the API structures this data!

1 Like

Hey @elgreco, Drew is on the right track, especially the suggestion to check taxLines.

The taxExempt field on the Order object only returns true when the customer was set to “Don’t collect tax” globally, or the “Charge taxes” option was unticked on a draft order. Specific exemptions that result in zero tax (like regional exemptions or reverse charge rules) don’t flip this flag. The changelog entry when this field was introduced explains this, and also notes that product-level tax exemptions aren’t factored in either.

So if the order had no tax charged because of a specific exemption mechanism rather than the customer being globally tax-exempt, taxExempt: false is the expected return. To actually see what happened with tax on the order, query taxLines on the order and its line items. Since May 2024, zero-value tax lines are returned in API responses, so you’ll see entries with a rate of 0.0 if an exemption was applied at calculation time. You can also check customer.taxExemptions to see which specific exemptions are set on the customer profile.

For the VAT ID, the answer depends on your setup. If you’re using B2B companies (Plus), you can query it via purchasingEntity { ... on PurchasingCompany { location { taxSettings { taxRegistrationId } } } } on the order.

If you’re using standard customer profiles, the VAT number that Shopify validates and stores isn’t exposed as a standalone string field on either the Order or Customer objects through the API.

Could you share a bit more on whether you’re using B2B companies or customer profiles, and which tax configuration you’re running?

Hey @Donal-Shopify

Thanks for the breakdown—that explains the taxExempt: false behavior perfectly.

Since we are using standard customer profiles rather than B2B, the lack of a standalone VAT ID string in the API is our main roadblock. If Shopify validates and stores this internally but doesn’t expose it on the Order or Customer objects, what is the recommended workaround for retrieving it?

Are you seeing most developers pull this from noteAttributes, or is there a specific metafield we should be targeting to get that validated VAT number into our sync?