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:
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
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
taxIdentifier, contacts, roleAssignments, and any order(id:) calls that could be scoped to a company.const taxId = location.taxIdentifier ?? 'N/A';Code Example – Safely Querying Locations and Orders
graphql
query CustomerData($customerId: ID!) {
customer(id: $customerId) {
id
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
taxIdentifier, contacts, and roleAssignments can be null or empty.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.
