Function "order routing location rule" does not split orders as expected

Topic summary

A developer implemented an order routing location rule function based on Shopify’s template documentation to manage fulfillment across Canadian and Danish locations.

Expected Behavior:
When an order contains products with different inventory availability (one only in Canada, another only in Denmark), the order should split based on the function’s location rankings.

Actual Problem:
Despite the function correctly outputting expected rankings (Canada rank 0 for one line item, not ranked for another), order splitting doesn’t occur. All line items are being fulfilled from the Danish location instead of splitting between locations.

Configuration Details:

  • Custom order routing location rule set as first priority
  • “Use ranked locations” as second rule
  • Default rules deleted
  • Function works correctly for basic single-location scenarios

Current Status:
The issue remains unresolved. The function produces correct ranking output, but Shopify’s order routing system doesn’t appear to act on these rankings to split the order as documented.

Summarized with AI on November 11. AI used: claude-sonnet-4-5-20250929.

Hi,

I’ve done the following:

  1. Created a “order routing location rule” function using the example from the template https://shopify.dev/docs/apps/fulfillment/order-routing-apps/location-rules/getting-started

  2. I have a shop with a Canadian shipping fulfillment location (from the default dev shop test data), and added a Danish shipping fulfillment location

  3. I have updated the order routing location rules - adding the new rule from the function as the first rule and deleted the default rules except “Use ranked locations” which is the second rule

The example works in basic scenario, i.e. the canadian fulfillment location is the fulfillment location on the order. BUT when I have an order with a product that is only available in Canada, and another product that is not available in Canada, only in Denmark, I would expect the order routing to split the order as Canada has rank 0 for one line item and the Canada location is not present in the ranking for the other product.

So the function output provides the expected ranking, but it does not seem to have an effect on the order - all lines are fulfilled at the Danish location.
The documentation from Shopify states “You can use location rules to rank the possible locations for a line item during checkout.” which is true c.f. the function result below, but it does not seem to have an actual effect on the order.

The function input:

{
  "fulfillmentGroups": [
    {
      "handle": "1",
      "inventoryLocationHandles": [
        "92419883313",
        "92419948849"
      ],
      "deliveryAddress": {
        "address1": "Gade 1",
        "city": "København N"
      }
    },
    {
      "handle": "2",
      "inventoryLocationHandles": [
        "92419883313",
        "92419916081"
      ],
      "deliveryAddress": {
        "address1": "Gade 1",
        "city": "København N"
      }
    }
  ],
  "locations": [
    {
      "handle": "92419883313",
      "address": {
        "countryCode": "DK"
      }
    },
    {
      "handle": "92419916081",
      "address": {
        "countryCode": "CA"
      }
    },
    {
      "handle": "92419948849",
      "address": {
        "countryCode": "DK"
      }
    }
  ]
}

The function output:

{
  "operations": [
    {
      "rank": {
        "fulfillmentGroupHandle": "1",
        "rankings": [
          {
            "locationHandle": "92419883313",
            "rank": 3
          },
          {
            "locationHandle": "92419948849",
            "rank": 3
          }
        ]
      }
    },
    {
      "rank": {
        "fulfillmentGroupHandle": "2",
        "rankings": [
          {
            "locationHandle": "92419883313",
            "rank": 1
          },
          {
            "locationHandle": "92419916081",
            "rank": 0
          }
        ]
      }
    }
  ]
}