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 "https://your-development-store.myshopify.com/admin/api/2023-07/draft_orders.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"
This is my code:
$shop = "xxxxxx.myshopify.com";
$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');
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