Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Hello,
I am trying to extract all orders a customer has placed over the past 5 days, and write those order names to the order.note of the newest flow-triggering order. Our fulfillment team will use that information to group multiple orders in one single shipment.
I have created a Flow that utilizes:
I understand if I execute Update Order Note from within the For each loop, the Flow will only write content to the notes of returned (past) orders, and not to the intended triggering order's. Therefore I tried to get the Flow to write the extracted order names to a global metafield (shop.metafields) and let the subsequent "Then" step (after exiting the For each loop) pull the constructed content from that shop.metafield and update the order note of the triggering order.
It looks like the For each loop could return the past order name as planned. However I am seeing issues when it comes to appending past order names as a single line text in the metafield.
For example:
It looks like to me the "expected to be updated" metafields_item.value did not pass on from one iteration to another. It seems like the loops did not know that the metafield value has been updated from its preceding loop, and always sees the immediate metafield value as A only.
I wasn't sure if I have done something wrong in the For each loop, so I created another simplified Flow solely for testing "append new values to the existing metafield value". However the result was the same. Each Update shop metafield action did not get the updated metafields_item.value from the preceding update action:
The liquid I put in the three Update shop metafield Action Value fields are:
-=-= Update shop metafield Action (1) =-=- {%- for metafields_item in shop.metafields -%} {%- if metafields_item.namespace == "custom" and metafields_item.key == "note_content" -%} {{ metafields_item.value | append: " B" }} {%- endif -%} {%- endfor -%} -=-= Update shop metafield Action (2) =-=- {%- for metafields_item in shop.metafields -%} {%- if metafields_item.namespace == "custom" and metafields_item.key == "note_content" -%} {{ metafields_item.value | append: " C" }} {%- endif -%} {%- endfor -%} -=-= Update shop metafield Action (3) =-=- {%- for metafields_item in shop.metafields -%} {%- if metafields_item.namespace == "custom" and metafields_item.key == "note_content" -%} {{ metafields_item.value | append: " D" }} {%- endif -%} {%- endfor -%}
The final updated metafield value was still A D , instead of the expected A B C D
I want to understand if metafield value can be updated shared/passed to another Action within the same Flow? Did I miss anything? Please advise how I can construct a list of past order names and write that the note of the triggering order.
Any comment is welcome. Thanks in advance!
I don't think you need metafields at all. You should be able to update the note on the original order by just connecting to after any conditions and then using liquid to determine what the note should be.
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024