Covers all questions related to inventory management, order fulfillment, and shipping.
We have a vendor which delivers products for us and we developed a small integration in our system where whenever an order is placed we forward the details to the vendor and they deliver the products, on processing the vendor invokes an api on our website which has info like tracking code, etc.
What we did now is
$request['fulfillment'] = array(
'location_id' => LOCATION_ID,
'tracking_company' => 'UPS',
'tracking_numbers' => array($tracking_id),
'tracking_number' => $tracking_id,
'order_id' => $order_id,
'line_items' => array(array('id' => $line_item_id, 'quantity' => 1)),
);
// Post above info to order/ORDER_ID/fulfillments.json and that created a fulfillment
Now with the Fulfillment api getting deprecated it is recommended to move on to FulfillmentOrder, We followed the migration guide and granted access to our private app to read and write fulfillments, Now what we see in the api is we can't create a fulfillment order as there is no api for that, we tried /admin/api/2021-10/orders/ORDER_ID/fulfillment_orders.json to get fulfillment_order id but it returned blank/no results. would like to know how should I create the fulfillment order using api?
Thanks,
Sadashiv.
Hi there @Gokhale_Method!
I just wanted to let you know I have moved your query here to the dedicated API forum in our Community.
As we're not in a position to provide API support directly ourselves, we have provided these threads as a place to ask about all things API-related.
These forums are moderated and responded to by our own developers and Partners, so they're the best place to look for input on this type of query.
Best of luck!
Don | Social Care @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
We have the same question. How do we update tracking using the new FulfillmentOrders API? We used to create new fulfillments and update tracking for those fulfillments, but now that resource is being deprecated and I do not see tracking information on the FulfillmentOrders resource.
Following. Our store has been getting the "deprecated" header when we fulfill orders, saying we need to move to the FulfillmentOrder. I don't quite understand how this works. The migration guide is a little unclear.
Not sure if you still have the same issue.
I noticed that you don't have to create FulfillmentOrder yourself. Those are already available for each order. So, you only to fetch FulfillmentOrders for an Order, then you will select which one is target to your location and use its ID to proceed fulfilment as explain in AdminApi.
Hope will help. Here is my snipets in Ruby:
#Fetch associated fulfilment order
fulfillment_orders = ShopifyAPI::FulfillmentOrder.all(
session: shopify_session,
order_id: order_id_int,
)
#Select default
fulfillment_order_id = nil
if fulfillment_orders != nil
fulfillment_orders.each do |fulfillment_order|
if fulfillment_order.assigned_location_id == current_location_id || fulfillment_orders.size == 1
fulfillment_order_id = fulfillment_order.id
end
end
end
#Create fulfilment, default to all items.
# Note: we don't need to specify all items, only fulfillment_order_id means default to all items
fulfillment = ShopifyAPI::Fulfillment.new(session: shopify_session)
fulfillment.message = "Test fulfillment completed"
fulfillment.notify_customer = true
fulfillment.line_items_by_fulfillment_order = [
{
"fulfillment_order_id" => fulfillment_order_id
}
]
fulfillment_response = fulfillment.save!
if fulfillment_response != nil
business_order.location_id = location_id
business_order.fulfillment_id = "#{fulfillment.id}"
success = business_order.save
end
Hi,
Thanks for providing info, problem with my app was it was a old app and when I was trying to fetch the fulfillment order with that app it was returning blank array i.e. no fulfillment order for the requested order. Inorder to test I tried apis on the developer account and for that I created a new app on that account and that returned the fulfillment order id, so I figured out that I need a new app and when I created a new app and granted the required permissions then I was able to retrieve the fulfillment order id and then with few more api's was able to push a fulfillment to shopify.
Thanks,
Sadashiv.