When someone orders 2 or more pieces of the same item, it shows as a separate line instead of reflecting in the quantity. How do I fix the code to change the quantity instead of adding another line?
Same item appears in a separate line item instead of changing quantity

Best answer by alex.hong
Hi
Thanks for the screenshot. In this case, you are seeing multiple lines for items based on how your store integration brings in that data! If those duplicate items are all being passed as Quantity:1 like they are now, then those duplicate products would all show up as individual lines. If the quantity passed is 2 for example, then only 1 line item will pass but display a quantity of 2. So it looks like your code isn’t adding quantity but instead creating additional items per amount. Each line item is one which may indicate that as opposed to one single line item with a quantity of 2 being passed like you intended, two individual (of the same product) line item is passed each with a quantity of 1 each.
Going off of that, I think it may have something to do with your checkout process causing the issue as well. Potentially, your checkout process that you are using is not passing the information in the default format/setup instructed by Shopify. Are you using a custom theme or checkout portal?
I would double check with your developers and report back any findings you may have on how the item arrays are set up as well as the entire checkout process.
Looking forward to your response,
Alex
Hi there
Just to add as a follow up to this:
In addition, if you modified the original table block or created your own table block, I would try saving the dynamic table block from our flows library for this flow as a discrete block and insert that into your template. So I would suggest you try using the default dynamic table block we use in our flows library for whatever flow you are triggering (assuming order confirmation). If after inserting our dynamic table block from the flows library, there’s still an issue with the duplicate product name, that would ensure that A. it’s not code-related, B. the standard Klaviyo code is being used, and C. that there is another issue maybe related to the checkout or due to the items actually being variants (i.e. different SKUs) with the same names. Then you would have to figure this out. If using the default dynamic table block fixes it then we know it was a code issue (you modified the original table block code or built your own) and it’s now solved.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.