Hi
Can someone have a word for the flow below? Like we’d need that we’d get customer tags added to each product, right now we’re only getting tags added per order.
please suggest, Thanks in advance.
Hi
Can someone have a word for the flow below? Like we’d need that we’d get customer tags added to each product, right now we’re only getting tags added per order.
please suggest, Thanks in advance.
Based on the screenshot, if an order has 10 products, this flow will 10 times add the same tag to the customer. Resulting in 1 tag added (at most).
You’d need to add a product handle or id to the tag to get 10 tags.
Hi @tim_tairli , product/item are not valid in the flow.
lineItems returns array only, can you specify the exact variable.
Using this flow now.
It’s not really clear what products tags you want to add to the customer or why.
But inside that For each
loop, you have a variable for the loop item (which will be tied to the line item). It would be something like “lineItemsForEachItem”. If you want to add every tag on the product to the customer, then you could then loop over the tag for the product in a second loop. And add the resulting variable to the customer tag:
Hey @paul_n , thanks for the sketch. Amazing help.
we also need {{order.createdAt}} for our conditional logics at the front end. So we’ve done something like, {{order.createdAt}}-{{tagsForeachitem}}
Right now, this flow provides me 3 tags every time no matter the quantities of product ordered but we want some unique tag for each product ordered.
Something like {{order.createdAt}}-{{product.id}} or {{order.createdAt}}-{{product.title}}
@paul_n Can you please help me figure out?, let me know if you need some more clarifications.
You are going to run out of characters in your tags, as they are limited to max of 42 characters.
Don’t use product.id
…if you need an ID, I’d use SKU
or product.legacyResourceId
.
If you need the same product in the same order to be added as multiple tags, you need to added a random number or counter. But I’d question why and whether you should be using tags for that. Instead, I’d look at metafields, which are more flexible for adding lists or something like that.
@paul_n we’re counting the total orders monthly and putting up a cap on monthly orders, metafields won’t provide us order count so come up with using flow.
would this work {{order.createdAt}}-{{product.sku}} or {{order.createdAt}}-{{product.legacyResourceId
}}, specially when the same product is added twice in an order as per my screenshot above?
How to add counter in the flow or random number, we’ll have both the cases like multiple products in the same order or it can be same product multiple times in a single order?
@paul_n please suggest.
Metafields is a way to store data like tags.
Why not instead, when a new order is created, get previous orders using the SKU and customer, and then count them?
Or have a metafield like “products_ordered” that has a JSON type, with something like:
{
"<product legacy id>": [
{ "qty": 2, "date_ordered": "<the date>" }
]
}
@paul_n, okay, these might be great solution but any way possible with the flow.
I’ve not idea of complications with metafields and I’m in really really hurry. I’ve spend some time with flow and used the conditional logics on the frontend accordingly.
Hey @Shikhar_Batra following up from our earlier thread just to +1 what Paul shared there .
I think your current Flow with tags is feasible, but we do recommend moving this to customer metafields so you avoid tag length limits and de-duplication.
You can create a customer metafield definition (for example using a JSON structure like Paul mentioned) using this guide: https://help.shopify.com/en/manual/custom-data/metafields/metafield-definitions/creating-custom-metafield-definitions, then update it in Flow when an order is created using the Update customer metafield action (https://help.shopify.com/en/manual/shopify-flow/reference/actions/update-customer-metafield).
Let me know if we can help out further though, happy to help out further if needed here as well
Okay @Alan_G, let me try this as well but do you mind sharing the flow sketch as well, would really help us a lot maybe a little guidance would do. I’m sure we’ll go for the metafields in the longer term but would be great like something like {{order.createdAt}}-{{order.product.product.qunatity}} could work.
Anyway, appreciate all the efforts to both of you.
Thanks in advance.
@Alan_G @paul_n Metafields logic won’t work for us, as we’re tracking the monthly orders when subscription is placed and it resets, once monthly period is over.
Do not forget also that each line item has quantity
field, so one line item may mean multiple physical items.
Proabbly a Run code would be needed.
Correct @tim_tairli , that’s not working either. In that case, all product tags are getting added irrespective of the quantity ordered.