Use Shopify Flow to check if at least 3 order line items contain products with a specific tag

Use Shopify Flow to check if at least 3 order line items contain products with a specific tag

dalestreet
Excursionist
12 1 3

We have some free samples that we want to add to orders where the following conditions are met:

  1. at least three order line items contain products with a specific product tag OR
  2. at least one order line item contains a product with that specific tag AND the quantity ordered is at least three

I can get #2 working, but not #1

Any suggestions would be greatly appreciated.

 

Thanks!

Replies 7 (7)

paul_n
Shopify Staff
1506 163 352

If you need to aggregate data to use in a condition, use Run code. We have a repo with example code. This example sums the number of products that match a title. 

https://github.com/Shopify/flow-code-examples/tree/main/run-code-examples/order-sum-products

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.
dalestreet
Excursionist
12 1 3

Hi Paul_n

Thanks for your response, however, I'm not even sure where to start with this. I've looked and can't see anything in the "Check if..." > Order step in Flow called "Run code". I've even skipped the conditions and looked at the action step and cannot find "Run code" there either. The information in Shopify Help for "Run code" doesn't clarify how or where to implement this either. Are there any resources or tutorials that would explain how to actually implement this? Thanks.


paul_n
Shopify Staff
1506 163 352

There is a "Run code" action. Add it as a new step before your condition. You can check the output in your condition, if needed.

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.
dalestreet
Excursionist
12 1 3

Thanks!

Kalen_Jordan
Shopify Partner
801 38 145

If you need any help with the run code step, let me know.

Leffrey
Explorer
43 0 17

I can use some help.  I never used "Run Code" in flow.  Some of our products are tagged with something like "ddd".  I need to know whether 2 or more "ddd" tagged units were ordered of one sku or combined 2 pieces of "ddd" tagged products from multiple skus.  So the trigger condition might be either 2 or more of the same tagged sku or at least 1 piece each of 2 or more tagged skus.

Kalen_Jordan
Shopify Partner
801 38 145

I can help on a paid basis if that's of interest. The link to my rates and payment options are in my signature.