Re: Flow that detects if order has more than 3 free items

Solved

Flow that detects if order has more than 3 free items

Clochette
Tourist
7 0 4

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!

Accepted Solution (1)

paul_n
Shopify Staff
1770 194 413

This is an accepted solution.

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.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

View solution in original post

Replies 3 (3)

JoesIdeas
Shopify Partner
2509 229 674

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.

• Creator of Order Automator [auto tag, fulfill, connect FBA, daily jobs]
• Co-Creator of Product Automator [suite of features for products / collections]
• Shopify developer for 10+ years, store owner for 7 years
• Blog: Shopify Tips, Guides, and Automation Tactics

paul_n
Shopify Staff
1770 194 413

This is an accepted solution.

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.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Clochette
Tourist
7 0 4

Thanks. I didn't even know I could add liquid code in there. Will try this 🙂