I am trying to fulfill the order via shopify rest api version 2023-01 by using the PHP and got the error message as below:
line_items_by_fulfillment_order - expected Hash to be a Array
I am unable to solve the issue i am using the below code to fulfill the order.
$fulfill_data_new_1 = array(
"fulfillment" => array(
"message" => "The package was shipped.",
"notify_customer" => false,
"tracking_info" => array(
"number" => "123456TN",
"company" => "ABC"
),
"line_items_by_fulfillment_order" => array(
"fulfillment_order_id" => "12345678",
"fulfillment_order_line_items" => (
array(
"id" => "254154654",
"quantity" => "1"
)
)
)
)
);
$fulfill_order_new = shopify_call($token, $shop, "/admin/api/2023-01/fulfillments.json", $fulfill_data_new_1, 'POST');
$fulfill_order_success_new = $fulfill_order_new['response'];
I have try to get fulfillment order ID, line item ID and its quantity by using the below code and its successfully return the ID. Only Issue is unable to fulfill the order by using New API version 2023-1
$get_orders_fulfill = shopify_call($token, $shop, "/admin/api/2023-01/orders/".$order_id."/fulfillment_orders.json", array(), 'GET');
// Convert product JSON information into an array
$get_orders_fulfill = json_decode($get_orders_fulfill['response'], TRUE);
$order_fulfill_id = $get_orders_fulfill['fulfillment_orders'][0]['id'];
$order_fulfill_line_item_id = $get_orders_fulfill['fulfillment_orders'][0]['line_items'][0]['id'];
$order_fulfill_line_item_qty = $get_orders_fulfill['fulfillment_orders'][0]['line_items'][0]['quantity'];
Can anyone help me to fix the issue?
Thanks