Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Hello hello!
I'm trying to create a workflow that adds a customer tag to a user, only if the line items in their order with a specific tag totals $25 or more. Basically noting what types of products a customer buys for segmenting.
I'm using workflows and can get the IF TAG part, but I can't seem to find the magic recipe to determine the total cost of those specific items. I can only seem to get the total of their entire cart. Any suggestions?
I've been trying a handful of different tactics as tests. See image attached.
Go ahead and type your thoughts here! This is a community!
instead of the order total amount maybe try the line item totals?
To elaborate a bit- conditions evaluate if something is true or false. They do not filter a list that you can use in the next step. If you want to check that a line item has a tag AND the value for that line item is > 25, you need to have those both in the same condition block (click add criteria for same list item to add multiple conditions for a single line item)
If you need to total all of the lineItems that have tags and then check if the total is over $25, the only way to do that is via Liquid in the action itself (as Flow doesn't have the necessary filter/aggregate tools yet). So you would need to write liquid in the tag field (possible) that loops over the line items, checks tags, adds the values, etc.
Thanks for the tip! I will give that a try and report back.
@paul_n Any advice? I keep getting errors (current is "final_line_price" is invalid. Replace this variable.), but I think I'm using the right properties based on the liquid documentation.
Any guidance is very much appreciated.
{% for line_item in order.lineItems %}
{ % if order.lineItems.product.tags contains 'Type: Chewy Candy' %}
{% increment line_item.final_line_price %}
{% if line_item.final_line_price > 25 %}
MORE_THAN_25_TEST
{% else %}
LESS_THAN_25
{% endif %}
{% endfor %}
{ % if order.lineItems.product.tags contains 'Type: Chewy Candy' %}
You cannot access array items this way in Flow. You need to loop over each array.
{% increment line_item.final_line_price %}
line_items isn't a variable and generally Flow doesn't use underscore for the available variables. Use "Add a variable" to see the right way.
{% if line_item.final_line_price > 25 %}
final_line_price is not a field
I'm curious if you know what the solution is, why you don't add it as a response instead of me struggling.
I don't know how to loop over each array or I would have done it.
If you follow my suggestion to use "Add a variable" and choose a property inside lineItems, it will insert the loop for you. It will look something like:
{% for li in order.lineItems %}
{{ li.quantity }}
{% endfor %}
Otherwise, there are too many unknowns about your use case for me to build the solution for you. If you reread my initial response, I had to make a set of guesses about what your intention is. And the potential solution varies quite a bit based on your intention.
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024