React Flow Counters
React Flow Counters
In this article:
What are counters?
An example from templates?
How to count how many people used the discount?
How to calculate how many products were bought with a tag HOT in a week?
✔️What are counters?
With the help of counters, you can develop scenarios that will help improve your store automation. The counter allows you to manage data calculations that can then be used in managing your store.
✔️An example from templates
One of the examples of using counters can be located in the Templates tab. Let's check it out together.
First, choose Tag HOT products template. It can help you identify and tag products that are purchased throughout the day. If a given product is also purchased the next day, the tag HOT stays in its place, but if not - the tag is automatically removed.
✔️How is this template implemented?
Step 1. Order line item created is a specific trigger that allows you to interact with a specific product and not with the entire order. If this event has occurred, it means that the product has been bought and has to be assigned a tag.
Step 2. Now, you need to set up a counter to understand whether a product was purchased throughout the day. This action has already been integrated into the template. Pay attention to the name of the counter. The respective variable specified in the template allows you to dynamically name the counter, whereas each product will have its own ID. In other words, you will have a separate counter for each product.
✅ You can use action Change trigger in any workflow chain, you can count literally anything in your store.
Step 3. Since the moment of purchase, let’s set a delay, say of 24 hours. If the counter has not been modified in the last 24 hours, then the tag should be removed
Step 4. If a certain product is bought daily, the counter will change without the tag being removed. You can adjust the conditions according to your needs. For example, change the time period after which the counter will be updated.
Counters are a flexible solution that allows you to implement almost any calculation you need, such as setting the counter as weekly and receiving the required reports.
✔️How to count how many people used the discount?
And to finish it up with another example. You might want to count how many people have used a gift certificate in your shop. To do this with the counter function, follow these steps:
Step 1. Select trigger Order created
Step 2. Add condition Order/discount
Step 3. Choose the matcher Is equal
Step 4. Write in line Value name of discount code
Step 5. Then add action Change counter and give a name to this counter.
If you wish, you can configure the sending of a letter to your email address and then reset the counter.
✔️How to calculate how many times a week hot tag products are ordered???
Let's count how often are products with the HOT tag are ordered in a week. We will configure sending an email to the store owner and resetting the counter. You need to reset the counter so that every week it starts counting from the beginning and you see the numbers for a specific week.
Step 1. Select trigger Order created
Step 2. Add condition Order/Line items ->
Step 3. Select the matcher Any of line items matches the following and select Line items/product tags -> Includes -> set the value HOT . Now we can count how many products with the tag HOT were bought in a week.
Step 4. Add action Change counter and give a name to this counter
Now you need to configure the sending of the letter to your mail address and the automatic reset of the counter every week. You can set up a separate flow for this.
Step 8. Choose Time of week as a trigger
Step 9. Then Send email
Step 10. In the text field add variable Counter name
Step 11. Add a delay of 5 minutes
Step 12. Finally сonfigure counter reset
With this flow, you've set up automatic email sending and counter resets to count the total number of products purchased with the tag HOT.
Suggestion articles
Components of the workflow
React Flow Templates
Most Popular Flows
Updated on: 19/06/2024
Thank you!