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 341

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"
}
}
]
}
}