Solved

Count order lines and add tag

phloo75
Visitor
3 0 0

Hello
I need a flow when an order is created to add a tag, if the order contains only 1 item.
Cant seem to find it in the flow app

Accepted Solution (1)
paul_n
Shopify Staff
788 118 189

This is an accepted solution.

The definition for that field: 

The sum of the quantities for all line items that contribute to the order's subtotal price.

 
In other words, if there is 3 of the same lineItem, it reports as 3. 
 
If you instead want to count lineItems and ignore the quantity of the lineItems, you can use Flow's "Count" step and use order.lineItems as the thing to count. Then check if that is 1. 
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)

paul_n
Shopify Staff
788 118 189

Flow has thousands of use cases, so not every use case is a template yet. 

 

For this one, you would build it something like:

  1. Order created (trigger)
  2. If order.subtotalLineItemsQuantity equal to 1
  3. Add order tag
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.
phloo75
Visitor
3 0 0

The problem with this is if a customer buys 3 pcs of a product the tag wont appear.
Even though it's only one item line.
I can't find any way to do this

Thank you

paul_n
Shopify Staff
788 118 189

This is an accepted solution.

The definition for that field: 

The sum of the quantities for all line items that contribute to the order's subtotal price.

 
In other words, if there is 3 of the same lineItem, it reports as 3. 
 
If you instead want to count lineItems and ignore the quantity of the lineItems, you can use Flow's "Count" step and use order.lineItems as the thing to count. Then check if that is 1. 
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.