Hi community!
I need some handlebars scripting help.
I have a post-purchase trigger that need to key off the SKUs and Quantity in the orders to customize a certificate.
I've got the handlebars variables in there to print out, but the qty variable is an array, so I'm having trouble pulling just the quantity for just the SKU in the array that I need. I've tried several different things but am getting nowhere.
Here is where I am:
<p>SKU: {{sku}}</p>
<p>QTY: {{qty}}</p>
Both of these work, but of course if there are multiple SKUs, it prints out multiple items.
So, for example, if I have three orders, I'd get the following:
SKU: PULL, PAP, LGH
QTY: 1, 2, 1
What I need to do be able to do it key off "PULL" and get the qty for that specific SKU.
I've tried sever IF statements, but can't get any results.
Here was the latest I tried.
{#ifContains sku "PULL"}}
{{qty}}
{{/ifContains}}
I would also be fine summing up all the SKUs to get a total number.
Page 1 / 1
Hi Steve! If the position of the QTY value will line up with the position of the SKU value, you could use ` qty.[0]`
If they don't always line up, it will be a little trickier. I see you've submitted a support ticket so that will be the next best step so you can share the payload of the event and an example user with our agent and we can investigate further!
If they don't always line up, it will be a little trickier. I see you've submitted a support ticket so that will be the next best step so you can share the payload of the event and an example user with our agent and we can investigate further!
Reply
Create a new Iterable Plaza community account
Already have an account? Login
Login to the Iterable Plaza Community
Not a customer? Create an account
Log in to Iterable (SSO)
Iterable customers and employees login/create an accountor
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.