Skip to main content

Manage client company locations

Plus

Only stores on the Shopify Plus plan can use apps with B2B features.

When a Shopify merchant conducts business-to-business (B2B) transactions, they sell their goods and services directly to other companies. You can use the GraphQL Admin API to create companies that represent those business customers and contain information about them.

A company can be associated with one or more company locations. Each company location contains information that can be used to change how orders are calculated and charged for a specific company context. For example, a company might have multinational branches that need to follow different billing and taxation rules.

This tutorial shows you how to add a location to a company and make updates to the location information.


In this tutorial, you'll learn how to do the following tasks:



Anchor to Step 1: Add a company location to a companyStep 1: Add a company location to a company

You can use the companyLocationCreate mutation to create and add a company location to a company:

POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

GraphQL mutation

mutation {
companyLocationCreate(companyId: "gid://shopify/Company/1", input: { name: "Second location"}) {
companyLocation {
id
name
}
userErrors { field message }
}
}

JSON response

{
"data": {
"companyLocationCreate": {
"companyLocation": {
"id": "gid://shopify/CompanyLocation/2",
"name": "Second location"
},
"userErrors": []
}
}
}

Anchor to Step 2: Set up tax exemptions for a company locationStep 2: Set up tax exemptions for a company location

If a company is exempt from sales tax at a location, then you should set up their tax exemption before they process any orders at that location.

Use the companyLocationAssignTaxExemptions mutation to override the relevant taxes on the company's account.

The following example sets multiple tax exemptions on one company location. For details on all possible tax exemptions, reference the TaxExemption documentation.

POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

GraphQL mutation

mutation {
companyLocationAssignTaxExemptions(companyLocationId: "gid://shopify/CompanyLocation/1", taxExemptions: [CA_BC_RESELLER_EXEMPTION, CA_STATUS_CARD_EXEMPTION] ) {
companyLocation {
id
taxExemptions
}
userErrors { field message }
}
}

JSON response

{
"data": {
"companyLocationAssignTaxExemptions": {
"companyLocation": {
"id": "gid://shopify/CompanyLocation/1",
"taxExemptions": [
"CA_BC_RESELLER_EXEMPTION",
"CA_STATUS_CARD_EXEMPTION"
]
}
}
}
}

Anchor to Step 3: Associate payment terms with a company locationStep 3: Associate payment terms with a company location

Payment terms determine when a company needs to pay for an order. This could be in advance of the order, at the time of order, or within a given amount of time that the merchant decides upon with the company.

To attach payment terms to a company, pass the buyerExperienceConfiguration input including a paymentTermsTemplateId to the companyLocationUpdate mutation.

Refer to the paymentTermsCreate mutation documentation for information on creating payment terms.

The following example assigns payment terms with the ID gid://shopify/PaymentTermsTemplate/2 to a company location:

POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

GraphQL mutation

mutation {
companyLocationUpdate(companyLocationId: "gid://shopify/CompanyLocation/22", input: {buyerExperienceConfiguration: {paymentTermsTemplateId: "gid://shopify/PaymentTermsTemplate/2"}}) {
companyLocation {
id
buyerExperienceConfiguration {
paymentTermsTemplate {
id
description
}
}
}
}
}

JSON response

{
"data": {
"companyLocationUpdate": {
"companyLocation": {
"id": "gid://shopify/CompanyLocation/22",
"buyerExperienceConfiguration": {
"paymentTermsTemplate": {
"id": "gid://shopify/PaymentTermsTemplate/2",
"description": "Within 7 days"
}
}
}
}
}
}


Was this page helpful?