Custom location code for Move fulfillment location action in flow

Custom location code for Move fulfillment location action in flow

mchart1980
Visitor
1 0 0

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.  

Replies 0 (0)