Import B2B orders
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.
RequirementsAnchor link to section titled "Requirements"
- 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.
LimitationsAnchor link to section titled "Limitations"
- 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.
How it worksAnchor link to section titled "How 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
customer.id in the request, a B2B order is created and associated with the company location.
Line item pricesAnchor link to section titled "Line item prices"
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.
API responseAnchor link to section titled "API response"
When an order is successfully created in a B2B context, the API response includes the following company details:
Example requestAnchor link to section titled "Example request"
The following request creates a B2B order for a company: