Custom location code for Move fulfillment location action in flow

Topic summary

Issue: Can’t dynamically set the “New location” in Shopify Flow’s Move fulfillment location action using Liquid.

  • Goal: Use an order custom attribute (key: “Pickup_Store”) to find a matching fulfillment location and move the fulfillment order there (pickup-only business, no shipping).
  • Approach: Liquid loops through getFulfillmentOrderData → order.customAttributes to get the target value, then matches it against locationsForMove_item.location.name and assigns locationsForMove_item.location.id to targetLocationId; outputs {{ targetLocationId }}.
  • Observation: The code snippet shows “locationsForMove_item.loca tion.id” (with a space), which may be a typo. Test emails output a location identifier like “gid://shopify/Location/###########”.
  • Problem: When this Liquid result is used in the Move fulfillment location action’s New location field, Flow errors with “not a valid location.”
  • Open questions: Does the action require a different identifier format (e.g., numeric ID vs GID) or a selected location reference rather than a Liquid string? Is the space/typo affecting the value?

Status: Unresolved; user seeks suggestions to make the dynamic location selection work.

Summarized with AI on December 30. AI used: gpt-5.

I am trying to use this code as the new location information in the Move Fulfillment location action in a workflow

{% assign customAttributeName = ‘Pickup_Store’ %}
{% assign targetLocationId = ‘’ %}

{% for getFulfillmentOrderDataForeachitem in getFulfillmentOrderData %}
{% if targetLocationId == ‘’ %}
{% for customAttributes_item in getFulfillmentOrderDataForeachitem.order.customAttributes %}
{% if customAttributes_item.key contains customAttributeName %}
{% assign targetValue = customAttributes_item.value %}
{% for locationsForMove_item in getFulfillmentOrderDataForeachitem.locationsForMove %}
{% if targetValue contains locationsForMove_item.location.name %}
{% assign targetLocationId = locationsForMove_item.location.id %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{{ targetLocationId }}

I have ran the code via a send email and the code return on Location SID per each loop. But when I put it into the new location is errors and says that it is not a valid location. The result in the email looks like this gid://shopify/Location/########### (masking the actual location number).

Anyone have any suggestions or tricks to make this work.

Basically I am trying to take custom attribute string look up the appropriate location from that and move the fulfillment order accordingly.

We are a pick up at select locations only business no mail deliver so the default rules aren’t much help here.

Thank you.