Hi,
Thanks for your time to look at this issue. Both fulfilment companies fulfil orders with a location_id.
In the front end in shopify, I can easily fulfil both fulfilment orders. These are my steps from our back-end:
Request:
GET: /orders.json?order=created_at asc
Response: (filtered out only the relevant parts)
{
"id": 4112281206983,
"app_id": 1354745,
"line_items": [{
"id": 10550566650055,
"fulfillable_quantity": 1,
"fulfillment_service": "manual",
"fulfillment_status": null,
"name": "Big Product",
"origin_location": {
"id": 3110096797895,
"name": "B2C Warehouse",
},
"product_exists": true,
"product_id": 6990829191367,
"quantity": 1,
"requires_shipping": true,
"sku": "doos",
"title": "Big Product",
"variant_id": 40894028316871,
"variant_inventory_management": "shopify",
"variant_title": "",
"vendor": "dozenverkoper",
}, {
"id": 10550566682823,
"fulfillable_quantity": 1,
"fulfillment_service": "manual",
"fulfillment_status": null,
"name": "Small Product",
"origin_location": {
"id": 3110096797895,
"name": "B2C Warehouse",
},
"product_exists": true,
"product_id": 6990828404935,
"quantity": 1,
"requires_shipping": true,
"sku": "koker",
"title": "Small Product",
"variant_id": 40894026416327,
"variant_inventory_management": "shopify",
"variant_title": "",
"vendor": "kokerverkoper",
}],
"refunds": [],
"shipping_lines": []
}
I did even split up the origin location per product. So with getting the order, both fulfilment companies know they can only ship their own products. There is no overlap in products between the two fulfilment companies.
The goal is that we can ‘just’ fulfil the order like if this was an order with only one fulfilment order attached.
So this is the request as the B2C fulfilment company:
POST to /orders/4112281206983/fulfillments.json
body:
{ fulfillment: { location_id: 65337262279, tracking_number: null } }
response:
{"errors":{"base":["None of the items are stocked at the new location."]}}
I think this is still strange, because I want to fulfil all items from this location. And according to the documentation, this should be possible. No restrictions mentioned.
So now I will include the line items per your example:
{"fulfillment":{"location_id":65337262279,"tracking_number":null,"line_items":[{"id":10550566682823}]}}
Response:
{"fulfillment":{"id":3663221489863,"order_id":4112281206983,"status":"success" ... }}
So this works!!
I did test all kind of things before (with line items, without line items). At least a first successful response now. I’ll keep on testing and implementing this in a live environment.
Again thanks.
Regards, Peter