How to place a draft order using storefront api?

Zia_Web
Tourist
6 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

0 Likes
Alex
Shopify Staff
Shopify Staff
1555 81 308

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.

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