Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I'm struggling to figure out a flow to do the following:
1.) Detect orders with a return (if true then)
2.) Loop the line items
3.) Check if a line item has a return reason (if true then)
4.) Get the product ID of the line item
5.) Append the reason as a new value in single line text (with list of values turned on) metafield on the product
Hope someone can point me in the right direction
There currently isn't a trigger for returns.
You could use "Get order data" and the "return_status" variable to get orders that have returns. I think the values are return_requested, in_progress, returned, so something like "return_status:returned" might work.
You would probably need to loop over the orders using the "For Each" step.
Items 3-5 could be done in the value field of a metafield using Liquid.
I'd encourage you to get the first part working and come back with questions once you get further.
Hi Paul,
I was using the trigger "Refund created" which works fine for my usecase.
What I'm initially struggling with is how to loop the line items and pass the product ID to the product metafield update action.
Any help there would be much appreciated
Assuming you want just the number part of the ID and not the GID, something like:
{% for refundLineItems_item in refund.refundLineItems %}
{{refundLineItems_item.lineItem.product.legacyResourceId}}
{% endfor %}
Thanks for the response Paul.
Here is what I have so far (I'm using order created trigger for the time being so I can test the flow without having to create new returns each time).
Where would I put that code and/or am I going about this all wrong.
Many thanks
Dave
You can't interchange those triggers because they provide different data (like the refund object I used). To do this, I think you would need to change the liquid I suggested to start with order.refunds instead of refunds
Fwiw, this changelog post has more information about newly released triggers, actions, and templates for working with returns in Flow.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey 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, 2024