Start building for B2B on Shopify
When a merchant engages in business-to-business (B2B) transactions, they sell their goods and services directly to other companies. You can use the GraphQL Admin API to build apps that solve the challenges that come with B2B commerce.
What you'll learn
Anchor link to section titled "What you'll learn"In this tutorial, you'll learn how to do the following tasks:
Requirements
Anchor link to section titled "Requirements"- You've created a Partner account and a development store.
- You've added products to your development store.
- Your app has the
unauthenticated_read_customers
,unauthenticated_write_customers
,read_products
,write_products
,read_draft_orders
, andwrite_draft_orders
access scopes. Learn how to configure your access scopes using Shopify CLI. - You're familiar with the concept of selling B2B.
Step 1: Create a company
Anchor link to section titled "Step 1: Create a company"When a merchant sells with B2B, a company represents information about who makes a B2B purchase. The following example creates a company by calling the companyCreate
mutation with the following inputs:
name
: The name of the company.companyLocation
: The location of the company. AcompanyLocation
must be added to attach important information, like tax exemptions, to the company.companyContact
: A contact at the company who can make purchases. AcompanyContact
must be added to create orders and draft orders.
Step 2: Create a B2B catalog
Anchor link to section titled "Step 2: Create a B2B catalog"A catalog is a set of products that's published and priced for certain customers based on specified conditions, such as whether they're buying for a certain B2B company location. For example, you can create a catalog that allows the Canadian branch of a company to purchase only the t-shirt products on the store, and they receive a 30% discount.
You can create and associate a catalog with a company location by passing the company location ID in the context
field of the catalogCreate
or catalogUpdate
mutation.
The following example uses the catalogCreate
mutation to create and associate a catalog with the company location from the previous step:
Step 3: Create a draft order for a company
Anchor link to section titled "Step 3: Create a draft order for a company"Merchants might want to create draft orders for company approval when selling B2B.
You can pass the purchasingCompany
input to the draftOrderCreate
mutation to create a new draft order for a company.
The purchasingCompany
input specifies the company ID, location, and contact. Billing and shipping information are included in the response because they aren't automatically populated from the company location. The lineItems
object indicates the items to be purchased in the order.
For more information on all possible inputs, refer to the DraftOrders
documentation.
- Learn how to create and add information to a company location by setting up tax exemptions and payment terms.
- Learn how to associate a price list and publication to a B2B catalog to determine the published products and prices for customers ordering for a specific B2B company location.
- Learn how to manage draft orders for B2B clients by calculating and sending invoices.