Use draft orders
Merchants often need to create draft orders for company approval when selling business-to-business (B2B). After creating a company, you can use the GraphQL Admin API to create draft orders for a purchasing entity. A purchasing entity is a combination of the company, company contact, and company location.
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"- Your app has the
write_products
access scope. Learn how to configure your access scopes using Shopify CLI. - You've added products to your development store.
- You've created a company.
Step 1: Calculate a draft order for a purchasing entity
Anchor link to section titled "Step 1: Calculate a draft order for a purchasing entity"Before creating a draft order for a purchasing entity, you can preview information such as total taxes and prices using the draftOrderCalculate
mutation:
Step 2: Create a draft order for a purchasing entity
Anchor link to section titled "Step 2: Create a draft order for a purchasing entity"When you're satisfied with the calculated draft order, you can create the draft order by passing the same input from your calculated draft order to the draftOrderCreate
mutation:
Step 3: Send an invoice for a draft order
Anchor link to section titled "Step 3: Send an invoice for a draft order"Sending an invoice for a B2B draft order is identical to sending an invoice for a consumer draft order. After creating a draft order, you can pass the draft order ID to the draftOrderInvoiceSend
mutation to send the invoice to the company contact:
Step 4: Mark a draft order as complete
Anchor link to section titled "Step 4: Mark a draft order as complete"Marking a B2B draft order as complete is identical to marking a consumer draft order as complete. After creating a draft order, you can pass the draft order ID to the draftOrderComplete
mutation to mark the draft order as complete and create a corresponding order:
- Learn how to create a B2B checkout UI with the GraphQL Admin API.