Ecommerce Shopify WordPress Discussion

Shopify API error when creating a Draft Order

Getting an error when making an API call to create a custom order in Shopify store. The error message I am receiving is {"errors":{"base":["Add at least 1 product"]}} From reading their documentation, I am sending the required parameters. Not sure if this is a formatting issue. This is their code curl -d '{"draft_order":{"line_items":[{"title":"Custom Tee","price":"20.00","quantity":2}],"customer":{"id":207119551},"use_customer_default_address":true}}' \ -X POST "" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" This is my code: $shop = ""; $token = "xxxxxxxxxxxxxxxx"; $query = array( "Content-type" => "application/json" ); $draft_param = array( "draft_order" =>array( "line-items" => array( "title" => "Toy Ball", "price" => "10.00", "quantity" => 1, "custom" => true, ), "customer" => array( "id" => 1655457444313, ), "use_customer_default_address" => true ) ) ; $draftorder = shopify_call($token, "$shop", "/admin/api/2023-07/draft_orders.json", $draft_param, 'POST');
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.