A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I'm trying to split Order LineItems between 2 locations, based on custom logic. All LineItems belong to the same FulfillmentOrder by default.
Example order:
Filfillment Order 1 (LocationId1):
LineItem a
LineItem b
LineItem c
LineItem d
LineItem e
I want it to be changed to be like this:
Filfillment Order 1 (LocationId1):
LineItem b
LineItem c
LineItem e
Filfillment Order 2 (LocationId2):
LineItem b
LineItem c
LineItem e
I'm not sure it it's possible, hope to get help here.
Hey @Jacob_D
It's possible to move the fulfillment order after the order was created with a call to move.json.
I must add that presently it's not possible to create an order and assign the Fulfillment Order assigned_location_id via API when the order is created.
Thanks - let me know how that goes!
Thanks, but moving fulfillment order isn't enough for me, I need to split it into 2 different fulfillment orders. Example structure:
Existing:
order
-fulfillment order1
--line item1
--line item2
--line item3
--line item4
--line item5
Desired:
order
-fulfillment order1
--line item1
--line item3
--line item5
-fulfillment order2
--line item2
--line item4
This exposes a neat issue in the fulfillment order mechanism. Glad you exposed that. So if I read the interpretation correctly, you can move everything but you cannot cherry pick line items for the move? So it is all or nothing in a move, and you don't get a separate fulfillment order, just a new one with a new location for all items?
Someone has to pay some love to this issue at some point.
If I understand correctly, there's no way to move individual line items with GraphQL or rest api after order is created. This question has been raised before:
https://community.shopify.com/c/Shopify-APIs-SDKs/Update-location-of-Individual-SKU-via-API/m-p/1064...
It does seem that that would be very important to merchants. If I am choosing to fulfill items on an order, I should be able to choose which location I fulfill from, regardless of the complexity that involves. I would be betting that becomes an API endpoint at some point, altering fulfillments by altering fulfillment orders, either directly or indirectly. Handing off basic fulfillment orders and expecting third-party manipulations to fill in the gap is unrealistic, and we already see how this setup is detrimental to last-mile delivery.
Hey @HunkyBill, @Jacob_D
As you folks had gathered, this isn't part of the Fulfillment order endpoint functionality presently. Currently it's only possible to move the entire Fulfillment Order today with the move endpoint and you can't split line items unfortunately.
I've made this known internally to the team in charge of the endpoint, who've noted the concern for the functionality for sure. This is something that we'll want to address - but alas I can't give an exact timeframe at present. We'll communicate any concrete updates in this area to our merchants/partners.
Thanks.
As the world turns! As it is now confirmed that no external services are at any advantage here, in the sense that no matter what they claim to do, we know that Shopify itself does not support this splitting, so henceforth when we deal with this issue with our merchants depending on us to solve this problem, we can point out, no one else has it solved either, since the real source of the issue is internal to Shopify.
So we wait till then, till Shopify updates, and I for one will not be investing any of my mental capital in fakery or pseudo-support via my external code for this issue. I'll let the dust settle inside Shopify!
Thanks for the update.
Hi @Luke_K , its been a few months since you posted this and also the old API was deprecated yesterday so this matter is very urgent. Can you tell us if as today (2dn January 2023) there is a way to split an order and send fulfillments from different locations using REST or GraphQL FulfillmentOrder and Fulfillment APIs?
Echoing that this is a big problem. When one warehouse is out of stock, Shopify will often split the line items between warehouses automatically. When orders are coming in with split fulfillment locations, it's important to be able to adjust them. In the admin section of the app, not even a human can change the order location on the line item level -- only the order level. So we're in a situation where a customer can place an order that results in split fulfillment, but it's literally impossible for a human or app to make changes to it. Thanks in advance to the devs that read this request and are working on this. Better handling of multi-location stores is an area that we care about. We eagerly await new developments in this area.
@Jacob_D @cowboybob @HunkyBill
So i found a solution to split orders. It is a (little bit of a) crazy hack and can be dangerous if something goes wrong.
If you (pseudo-)fulfill part of the order, you can then move the rest of the order to a new location. You can then cancel the fullfillment and you have successfully split the order into two locations. This way also works manually and with graphql. Here is my code:
First the code for partially fulfilling an order. As you can see notifyCustomer is false, so that the customer doesn't get alerted for the changes, that we are making.
mutation fulfillmentCreateV2 {
fulfillmentCreateV2(fulfillment: {
notifyCustomer: false,
lineItemsByFulfillmentOrder: [
{
fulfillmentOrderId: "gid://shopify/FulfillmentOrder/23423423423",
fulfillmentOrderLineItems: {
id: "gid://shopify/FulfillmentOrderLineItem/234242342342",
quantity: 3
}
}
{
fulfillmentOrderId: "gid://shopify/FulfillmentOrder/23423423423",
fulfillmentOrderLineItems: {
id: "gid://shopify/FulfillmentOrderLineItem/234242342343",
quantity: 1
}
}
]
})
{
fulfillment {
id
status
trackingInfo {
company
number
url
}
}
userErrors {
field
message
}
}
}
As an output, you get the id for the fulfillment that you need to keep for the last part of the code.
Secondly, you move the unfulfilled part of the fulfillment order to another location.
mutation fulfillmentOrderMove {
fulfillmentOrderMove(id: "gid://shopify/FulfillmentOrder/23423423423"
, newLocationId: "gid://shopify/Location/234234234" ) {
movedFulfillmentOrder {id}
originalFulfillmentOrder {id}
remainingFulfillmentOrder{id}
userErrors {
field
message
}
}
}
As last point, you now cancel the fulfillment. You get the right fulfillment id from the first code:
mutation fulfillmentCancel {
fulfillmentCancel(id: "gid://shopify/Fulfillment/23424234") {
fulfillment {
id
status
}
userErrors {
field
message
}
}
}
The order is now split into two locations.
I hope that will help some of you
Gutsy strategy! Thanks for showing that off. That is a cool trick. So nutso that we have to resort to that to do something that should be easier.
There seems to be a problem with the documentation of https://shopify.dev/api/admin-graphql/unstable/objects/FulfillmentOrderLineItem
It says that you can get the variant sku number or the product title, but when I try to get that information I recieve the next error:
"message": "Field 'sku' doesn't exist on type 'FulfillmentOrderLineItem'"
I would use the LineItem inside FulfillmentOrderLineItem, but it's apparently deprecated.