Flow that detects if order has more than 3 free items

Hi!

I can’t figure out how to build a flow that will tag an order that had more than 3 free items in it (4+ items at $0 each). I can do 1 item but not sure how to do for more. They are not necessary the same SKU.

Thanks for helping!

I don’t know how to do this natively in Shopify but if you aren’t able to find a solution and need a plan B, Order Automator app does a bunch of things like this. If there isn’t an exact solution in the app, you can get free custom rules built to match your store’s needs.

1 Like

You can write some liquid in the tag itself to count the number of free items. Something like:

{% assign free_count = 0 %}

{% for li in order.lineItems %}

{% if li.discountedTotalSet.shopMoney.amount <= 0 %}

{% increment free_count %}

{% endif %}

{% endfor %}

{%- if free_count >= 4 -%}YOUR_TAG{%- endif -%}

You may have to make that all fit on one line when you enter it into the tag field.

1 Like

Thanks. I didn’t even know I could add liquid code in there. Will try this :slightly_smiling_face:

1 Like