I am using Fulfillment Constrains function to specify the fulfillment warehouses (locations) at Checkout. And I faced an issue when trying to split single variant between 2 locations.
Let me describe the business case I am trying to solve:
There are 2 locations, both in US. The inventory of product A are 3 and 3 in respective locations. When customer orders 5 items, I want to specifically define that 3 items should be fulfilled from Location B, and 2 items from Location A.
Note: I cannot use global order routing rules to prioritise Location B, since it will affect all orders., while I need priority to be determined by custom logic. I also need fulfillment to be defined at checkout because it affects shipping calculation.
So, if I specify 2 location, Shopify prioratise location 82538496228 by default, but I need 87490003172:
[
"deliverableLinesMustFulfillFromAdd": {
"deliverableLineIds": [
"gid://shopify/DeliverableCartLine/1",
],
"locationIds": ["gid://shopify/Location/87490003172", "gid://shopify/Location/82538496228"]
}
]
I know that a Fulfillment Constrains function defines the fulfillment location on deliverableLines level which is more or less same as cart line item level. So i split the line item into 2 line items (by adding attribute).
Now I can specify separate locations for each line item:
[
{
"deliverableLinesMustFulfillFromAdd": {
"deliverableLineIds": [
"gid://shopify/DeliverableCartLine/0"
],
"locationIds": [
"gid://shopify/Location/82538496228"
]
}
},
{
"deliverableLinesMustFulfillFromAdd": {
"deliverableLineIds": [
"gid://shopify/DeliverableCartLine/1"
],
"locationIds": [
"gid://shopify/Location/87490003172"
]
}
}
]
But at checkout, I get No Delivery Available error, and 1 line item is removed:
I have noticed that it happens because I specified different locations for the save product variant. Meaning, the Fulfillment Constrains function operated on product variant level rather than deliverableLine level.
Can you please verify it it’s a bug in Fulfillment Constrains function?
Maybe there is a different way to achieve my goal? Thank you!
