Understanding the New B2B Location Access Rules in Shopify’s Customer Account API

Shopify’s latest API update tightens B2B location data access, limiting what customers can see to their own company information and orders. Learn what changed, who’s affected, and how to adapt your apps.

Understanding the New B2B Location Access Rules in Shopify’s Customer Account API
8 sections

Shopify just rolled out a focused update to the Customer Account API that changes how B2B customers see company locations and order data. The change is subtle— the GraphQL schema stays the same— but the returned values now respect a customer’s role within a company. If you build apps that surface location tax info, contact lists, or corporate order history, you’ll need to handle nulls and empty arrays gracefully. This post breaks down the update, explains who it affects, and gives you concrete steps to keep your integrations running smoothly.

What Changed in the Customer Account API

The core of the update is a tighter data‑visibility rule for B2B customers: a customer can now read only the company data and the orders belonging to companies they are actively associated with. The GraphQL types (Company, CompanyLocation, CompanyContact, etc.) remain unchanged, but several fields will now return null, an empty list, or fewer results when the requesting customer lacks a role on the underlying record. Specifically:

  • CompanyContact.locations returns an empty list unless the contact belongs to the current customer.
  • For a CompanyLocation where the customer has no role, the taxIdentifier field returns null and the contacts and roleAssignments fields return empty arrays.
  • When a merchant removes a customer from a company, any query for order(id:) or draftOrder(id:) that targets that company’s orders will be denied, and the customer’s personal order list no longer includes the removed company’s orders.
  • Who Is Affected: Developers vs. Merchants

    Developers – Anyone building public or private apps that call the Customer Account API, especially those that aggregate location tax identifiers, contact rosters, or corporate order histories, will see the new null/empty responses. The change does not require a schema migration, but it does require defensive coding.

    Merchants – Store owners who rely on B2B features (wholesale storefronts, corporate accounts, etc.) will notice that a former employee or former partner no longer sees the company’s locations or orders after they are removed. The UI in Shopify admin already respects these rules; the update simply aligns the API with the admin experience.

    Implications for Developers

  • Null safety is now mandatory – Any field that previously always returned data (e.g., taxIdentifier) can be null if the caller lacks a role. Your GraphQL resolvers or front‑end renderers must check for null before use.
  • Empty arrays signal missing permissions – An empty locations list does not mean the company has no locations; it means the current customer cannot see them. Adjust UI messages accordingly.
  • Order queries are filtered – After a customer is removed from a company, calls to order(id:) or draftOrder(id:) for that company will throw an authorization error. Your error handling should distinguish “not authorized for this company” from generic “order not found” cases.
  • No schema changes – Because the schema stays the same, you do not need to update your GraphQL queries, but you should add defensive code around the affected fields.
  • Testing – Add test cases that simulate a customer with and without a role on a company location to verify your app’s behavior under both conditions.
  • Implications for Merchants

    Merchants will see a more accurate order history for each B2B customer. When a user is removed from a company, the orders they placed on behalf of that company disappear from their personal order feed, reducing confusion and protecting sensitive corporate data. No manual action is required on the merchant side, but it’s worth communicating the change to B2B users so they understand why certain orders or locations no longer appear in their accounts.

    Actionable Steps: Updating Your Apps

  • Audit your data fetches: Search your codebase for taxIdentifier, contacts, roleAssignments, and any order(id:) calls that could be scoped to a company.
  • Add null/empty guards: Wrap each access in a conditional check. For example, in JavaScript: const taxId = location.taxIdentifier ?? 'N/A';
  • Improve error handling: Catch GraphQL errors that indicate a missing role and surface a friendly message such as “You no longer have access to this company’s orders.”
  • Update UI messaging: If a locations list is empty, display “You do not have permission to view locations for this company.” instead of a generic “No locations found.”
  • Refresh documentation: If you publish API docs for partners, note the new visibility rules under the CompanyLocation and Order sections.
  • Run regression tests: Simulate a user being removed from a company and verify that your app gracefully handles the missing data.
  • Code Example – Safely Querying Locations and Orders

    graphql

    query CustomerData($customerId: ID!) {

    customer(id: $customerId) {

    id

    email

    company {

    id

    name

    }

    # Locations the customer can see

    locations {

    edges {

    node {

    id

    name

    taxIdentifier # May be null if no role

    contacts {

    edges {

    node { id name }

    }

    }

    }

    }

    }

    # Orders the customer can see

    orders(first: 20) {

    edges {

    node {

    id

    name

    purchasingEntity {

    ... on CompanyLocation {

    id

    }

    }

    }

    }

    }

    }

    }

    js

    // Example JavaScript guard logic

    function formatLocation(loc) {

    const taxId = loc.taxIdentifier || 'Not available';

    const contacts = loc.contacts?.edges?.map(e => e.node.name) || [];

    return ${loc.name} – Tax ID: ${taxId} – Contacts: ${contacts.join(', ') || 'None'};

    }

    async function fetchCustomerData(customerId) {

    const data = await graphQLClient.request(QUERY, { customerId });

    const visibleLocations = data.customer.locations.edges

    .map(e => e.node)

    .filter(loc => loc.name); // filter out empty results if any

    visibleLocations.forEach(loc => console.log(formatLocation(loc)));

    // Handle orders – ignore those that throw authorization errors

    const orders = data.customer.orders.edges.map(e => e.node);

    console.log('Accessible orders:', orders.length);

    }

    Key Takeaways

  • The Customer Account API now enforces role‑based visibility for B2B locations and orders.
  • No schema changes, but fields like taxIdentifier, contacts, and roleAssignments can be null or empty.
  • Developers must add null/empty checks and improve error handling; merchants need only be aware of the more accurate order history.
  • Updating your app is mostly about defensive coding—no query rewrites are required.
  • Test scenarios where a customer loses a company role to ensure a seamless user experience.
  • Conclusion & Next Steps

    Shopify’s B2B location access update aligns the API with the platform’s security expectations, giving companies tighter control over who can see sensitive data. By auditing your queries, adding null guards, and handling authorization errors gracefully, you can keep your apps reliable and your merchants happy. Need a deeper dive or a code review? Drop a comment below or reach out to our Shopify developer consultancy for a personalized walkthrough.

    Tags
    Sources

    Related Articles

    Admin‑Created Custom Apps Now Live in the Shopify Dev Dashboard

    Admin‑Created Custom Apps Now Live in the Shopify Dev Dashboard

    Shopify now surfaces custom apps built in the admin inside the Dev Dashboard, giving developers centralized credential control, IP allowlisting, and full API/webhook logs. Learn what changed, who’s affected, and how to secure and monitor your apps today.

    November 17, 20265 min
    Amazon EventBridge Webhook Payloads Now Up to 1 MB – What It Means for Your Shopify Apps

    Amazon EventBridge Webhook Payloads Now Up to 1 MB – What It Means for Your Shopify Apps

    Shopify increased the Amazon EventBridge webhook payload limit from 256 KB to 1 MB, letting developers receive larger product and order data inline. Learn who is affected, how it works, and what steps to take now.

    November 17, 20265 min
    Unlock Custom Data Insights: Sidekick Now Analyzes Metafields & Metaobjects

    Unlock Custom Data Insights: Sidekick Now Analyzes Metafields & Metaobjects

    Sidekick can now read your store’s custom metafields and metaobjects, letting merchants ask analytics questions about fabric, supplier, designer and more. Learn what changed, who it affects, and how to start using this feature today.

    November 17, 20265 min
    Test Your Apps Early: Opt‑In to Admin API Token Expiry from the Dev Dashboard

    Test Your Apps Early: Opt‑In to Admin API Token Expiry from the Dev Dashboard

    Learn how to enable the new Admin API token expiry setting in the Shopify Dev Dashboard, why it matters for public apps, and step‑by‑step actions to test and validate your migration before the April 1, 2027 enforcement deadline.

    November 16, 20264 min