We have an order routing function where we’re routing the whole order to a single warehouse in certain situations.
It seems to work correctly when we have a non-zero inventory level in the warehouse in question for both products.
But when one product has inventory zero in that warehouse, it doesn’t work. We have Continue selling when out of stock set.
This is an example of a run where it tried to rank the LA warehouse higher than the NC warehouse:
https://partners.shopify.com/411398/apps/193114112001/extensions/function/896789217281/runs/07839030-72ba-499d-aab3-8564d0b74f24
{
"cart": {
"lines": [
{
"merchandise": {
"id": "gid://shopify/ProductVariant/41882367033462",
"sku": "",
"title": null,
"product": {
"id": "gid://shopify/Product/7634763874422",
"title": "LOCATION-RULE TESTING - Product in Both - 0 in LA, 10 in HP"
},
"losAngeles": {
"value": "0"
},
"northCarolina": {
"value": "10"
}
}
},
{
"merchandise": {
"id": "gid://shopify/ProductVariant/41882366902390",
"sku": "",
"title": null,
"product": {
"id": "gid://shopify/Product/7634763743350",
"title": "LOCATION-RULE TESTING - Product in Both - 10 in LA, 0 in HP"
},
"losAngeles": {
"value": "10"
},
"northCarolina": {
"value": "0"
}
}
}
]
},
"fulfillmentGroups": [
{
"handle": "1",
"inventoryLocationHandles": [
"67514007670",
"67514040438"
],
"lines": [
{
"merchandise": {
"id": "gid://shopify/ProductVariant/41882367033462",
"product": {
"id": "gid://shopify/Product/7634763874422",
"title": "LOCATION-RULE TESTING - Product in Both - 0 in LA, 10 in HP"
}
}
}
]
},
{
"handle": "2",
"inventoryLocationHandles": [
"67514007670",
"67514040438"
],
"lines": [
{
"merchandise": {
"id": "gid://shopify/ProductVariant/41882366902390",
"product": {
"id": "gid://shopify/Product/7634763743350",
"title": "LOCATION-RULE TESTING - Product in Both - 10 in LA, 0 in HP"
}
}
}
]
}
],
"locations": [
{
"handle": "67514007670",
"name": "High Point, NC",
"address": {
"city": "***",
"countryCode": "US"
}
},
{
"handle": "67514040438",
"name": "Los Angeles, CA",
"address": {
"city": "***",
"countryCode": "US"
}
}
]
}
Result:
{
"operations": [
{
"rank": {
"fulfillmentGroupHandle": "1",
"rankings": [
{
"locationHandle": "67514040438",
"rank": 0
},
{
"locationHandle": "67514007670",
"rank": 1
}
]
}
},
{
"rank": {
"fulfillmentGroupHandle": "2",
"rankings": [
{
"locationHandle": "67514040438",
"rank": 0
},
{
"locationHandle": "67514007670",
"rank": 1
}
]
}
}
]
}
But the order ended up split between the two warehouses:
The reason we want to route to a warehouse even when it has zero stock is so we can fulfill against future stock it will have and keep shipping cost low for the customer.
Also our location routing rule is the only order routing rule configured in order routing.