Import B2B orders
Only stores on the Shopify Plus plan can use apps with B2B features.
This tutorial describes how to import historical order data. To create and collect payment for B2B orders, refer to the Manage draft orders tutorial instead.
A business-to-business (B2B) merchant might run certain B2B operations outside of Shopify, but want to import their non-Shopify B2B orders into Shopify. This can help the B2B merchant to move their B2B business to Shopify without losing historical order data, and enable buyers to review their full order history within their customer account pages on a Shopify storefront.
In this tutorial, you'll learn how to import orders with the REST Admin API and associate them with B2B company locations and company contacts.
Anchor to RequirementsRequirements
- You've added products to your development store.
- You've created a company location.
- You've created a company contact and assigned the company contact a role at the company location.
Anchor to LimitationsLimitations
- A B2B merchant must import or create all relevant companies, company locations, company contacts, and products in Shopify before they can import B2B orders. If these resources aren't created in Shopify before the order import, then an error is returned.
Anchor to How it worksHow it works
The B2B order import feature uses the REST Admin API's POST orders
endpoint to enable B2B merchants to import B2B orders into Shopify.
When you include both company.location_id
and customer.id
in the request, a B2B order is created and associated with the company location.
The customer must have a role assignment to the specified company location. If the customer doesn't have a role assignment to that location, then an error is returned.
Anchor to Line item pricesLine item prices
The line_item.price
isn't a required parameter for importing B2B orders. When a merchant doesn't add prices to their line items, the API populates the line_item.price
automatically based on the variant price.
Because this can result in inaccurate order data, you should implement validation logic within the app to ensure that merchants input accurate price data when importing B2B orders.
Anchor to API responseAPI response
When an order is successfully created in a B2B context, the API response includes the following company details:
Anchor to Example requestExample request
The following request creates a B2B order for a company: