I am trying to fulfilment by line items with shopify API but it is not working
this is my demo store
I have add all the thing original demo store name and access key
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://bforbay.myshopify.com/admin/api/2023-10/fulfillments.json',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"fulfillment": {
"line_items_by_fulfillment_order": [
{
"fulfillment_order_id": 5749831630946, // this one is order id
"fulfillment_order_line_items": [
{
"id": 13418123853922, // one iteam id
"quantity": 1
}
]
}
],
"tracking_info": {
"number": "AWEADSF898",
"url": "https://www.my-shipping-company.com?tracking_number=MS1562678"
}
}
}',
CURLOPT_HTTPHEADER => array(
'X-Shopify-Access-Token: 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',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
I am geting error {"errors":"Not Found"} why?
I have read_fulfillments,write_fulfillments scope also
I try to get the fulfillment id also
get: https://bforbay.myshopify.com/admin/api/2023-04/orders/5749831630946/fulfillment_orders.json
header: X-Shopify-Access-Token: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
but get this
{
"fulfillment_orders": []
}
2
Answers
To create fulfillments, the URL usually follows this format:
https://{store-name}.myshopify.com/admin/api/2023-10/orders/{order_id}/fulfillments.json
. It seems like you’re missing theorders/{order_id}
part in your URL. Try thisYou can use shopify Graphql APIs too for fulfilling the orders:
Find the fulfillment order ID from the above query and then run the below mutation for fulfilling the order.