Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to place a draft order using storefront api?

How to place a draft order using storefront api?

Zia_Web
Tourist
7 0 1

Hi everyone

I'm trying to build a mobile app in ionic using Shopify storefront api, 

fetching products is ok and adding item to cart is also ok, now;  how to place an order?  I thing  storefront api doesn't support creating draft order

If I use admin api, then how about  to use admin api for all(fetching products, customers, orders ..etc)?

please help someone

thank you

Replies 2 (2)

Alex
Shopify Staff
1561 81 343

You cannot create draft orders using the storefront API, as it is intended to emulate interactions with the storefront, and draft orders are not expected to be created there.

You can reference the REST Admin API documentation here to get a sense of how to fetch or create products, customers, orders, etc. or you could check out the GraphQL Admin API here.

Cheers.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

shahid_ansari
Tourist
3 0 1

how i can add two or more products in single draft order. I added line item like that but it is not working

{
"draft_order": {
"line_items": [
{
"title": "Custom Tee",
"price": "20.00",
"quantity": 1,
"applied_discount": {
"description": "Custom discount",
"value_type": "fixed_amount",
"value": "10.0",
"amount": "10.0",
"title": "Custom"
}
},
{
"title": "Custom Tee2",
"price": "20.00",
"quantity": 2,
"applied_discount": {
"description": "bulk discount",
"value_type": "fixed_amount",
"value": "2.0",
"amount": "10.0",
"title": "bulk discount"
}
}
]
}
}