Automate Tax-Exempt Status with Shopify Customer Tags | B2B Compliance

Update Tax-Exempt Status on Company Locations Using Shopify Customer Tags

7 min setup

No coding required

Runs automatically

Easily manage B2B tax exemptions by automating the tax-exempt status for company locations based on Shopify customer tags. This MESA workflow template triggers when a customer is tagged with “Exemption,” prompting MESA to locate the associated company and update its tax-exempt status. Simplify sales tax compliance, streamline the management of exemption certificates, and disable taxes for wholesale customers at scale with minimal manual effort.

How it works

7 steps to start updating B2B company tax exemptions from customer tags automatically

Customer Tags Changed

App connector: [Shopify](/content/apps/shopify/integrate "View Shopify integration page"/index.html)• Time to complete: 0 minutes (Auto-configured)

Why this matters: This trigger captures customer tag modifications, enabling tax exemption management through tags rather than manual company location updates in Shopify Plus admin, streamlining B2B tax compliance workflows.

When customer tags are updated in Shopify (tags added, removed, or modified through admin, API, or apps), this trigger activates the workflow and captures the customer ID and complete current tag list. The includeFields parameter limits the trigger to only fire when tags actually change (not on every customer update), improving efficiency. No configuration is required—it's pre-connected to your Shopify store and monitors tag changes automatically.

Use case: B2B merchants can tag customers with specific tax exemption codes (like "CA_BC_COMMERCIAL_FISHERY_EXEMPTION" for British Columbia commercial fishing exemptions) and have those exemptions automatically apply to all company locations associated with that customer.

Grab Exemption Tags

App connector: [Code](/content/apps/custom/integrate "View Code integration page"/index.html)• Time to complete: 0 minutes (Auto-configured)

Why this matters: Filters the customer's complete tag list to identify only tags formatted as official tax exemptions, preventing non-exemption tags from being processed and ensuring only valid exemption codes are applied to company locations.

This custom JavaScript step processes the customer's tag list to extract tax exemption tags.

Tag format requirement: Exemption tags must follow Shopify's tax exemption naming convention and contain the word "EXEMPTION" (like CA_BC_COMMERCIAL_FISHERY_EXEMPTION, CA_BC_CONTRACTOR_EXEMPTION, US_CA_RESELLER_EXEMPTION). The code splits the comma-separated tags, trims whitespace, checks each tag for the string "EXEMPTION", and returns an array of matching exemption tags.

// Splits tags, trims whitespace
let tags = vars.shopify.tags.split(',').map(element => element.trim());
// Filters to only tags containing "EXEMPTION"
for (let tag of tags) {
  if (tag.includes('EXEMPTION')) {
    exemptionTags.push({"tag": tag})
  }
}

The filtered exemption tags are returned as an array where each element contains a tag property ready for processing.

Loop Over Exemption Tags

App connector: [Loop](/content/apps/loop/integrate "View Loop integration page"/index.html)• Time to complete: 0 minutes (Auto-configured)

Why this matters: Processes each identified tax exemption tag individually, enabling application of multiple exemptions to the customer's company locations when customers qualify for several tax-exempt categories.

This loop iterates through the array of exemption tags from the previous step. For each exemption tag, the loop executes the subsequent company location retrieval and update steps. This ensures that if a customer has multiple exemption tags (like both CA_BC_COMMERCIAL_FISHERY_EXEMPTION and CA_BC_CONTRACTOR_EXEMPTION), all exemptions are properly applied to their company locations.

Get Locations Customer Is Assigned To

App connector: [Code](/content/apps/custom/integrate "View Code integration page"/index.html)• Time to complete: 0 minutes (Auto-configured)

Why this matters: Retrieves all company locations where this customer is assigned in Shopify's B2B structure, identifying which locations need the tax exemption applied to ensure comprehensive coverage across the customer's business relationship.

This custom JavaScript step queries Shopify's B2B system to find company locations associated with the customer using the customer ID. In Shopify Plus B2B, customers can be assigned to multiple company locations (different business addresses, warehouses, branches), and tax exemptions need to apply across all relevant locations. The code uses ShopifyUtil.companyLocationsForCustomer to retrieve the location list and returns an array of company location objects.

Loop Over Company Locations

App connector: [Loop](/content/apps/loop/integrate "View Loop integration page"/index.html)• Time to complete: 0 minutes (Auto-configured)

Why this matters: Processes each company location individually, ensuring the tax exemption is applied to every location where the customer is assigned rather than just one location.

This loop iterates through the array of company locations from the previous step. For each location, the loop executes the location retrieval and tax exemption update steps using the company location ID. This nested loop structure (outer loop for exemption tags, inner loop for locations) ensures every exemption is applied to every relevant location.

Retrieve Company Location

App connector: [Shopify Plus](/content/apps/shopify-plus/integrate "View Shopify Plus integration page"/index.html)• Time to complete: 0 minutes (Auto-configured)

Why this matters: Fetches complete company location details needed for the tax exemption update operation, ensuring the workflow has all necessary context and data about the location before modifying its tax status.

This step retrieves the full company location record from Shopify Plus using the company location ID from the loop. It returns complete location information including current tax exemption status, location details, and associated company data. This information is used in the subsequent update step to properly apply the tax exemption.

Shopify Plus requirement: This step uses Shopify Plus B2B features. The workflow requires a Shopify Plus account with B2B capabilities enabled.

Update Location's Tax Exempt Status

App connector: [Code](/content/apps/custom/integrate "View Code integration page"/index.html)• Time to complete: 0 minutes (Auto-configured)

Why this matters: Applies the tax exemption to the company location using Shopify's official tax exemption system, ensuring orders from this location process with correct tax calculations and maintaining tax compliance for B2B transactions.

This custom JavaScript step updates the company location's tax exemption status. The code uses ShopifyUtil.assignTaxExemptStatusToLocation with the company location ID and the exemption tag to apply the exemption through Shopify's GraphQL API. This updates the location's tax configuration so that orders placed by contacts at this location receive appropriate tax exemptions based on the assigned exemption codes.

Tax exemption application: Shopify maintains a list of valid tax exemption codes for different regions and exemption types. When applied to a company location, these exemptions automatically affect tax calculations during checkout for orders associated with that location.