Solved

Same item appears in a separate line item instead of changing quantity

  • 15 September 2021
  • 4 replies
  • 255 views

Badge +2

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?

icon

Best answer by alex.hong 25 September 2021, 10:59

View original

4 replies

Userlevel 7
Badge +58

Hi @jdbrngr ,

 

Thanks for posting to the Community and hope to get you some insight into what might be going on.

To start, is it possible that these two items are variants of each other? If that were to be the case, in any post-purchase flow or transactional flow it would show the separate items instead of adding quantity. Would you mind showing screenshots (hiding private data of course) of your test preview where you should be expecting quantity to go up? 

It could also be an issue with how the template itself is setup and pulling data. In the meantime, I would look at these documents to ensure things were properly set up:

How to Build Dynamic Blocks in a Flow Email

How to Show or Hide Template Blocks Based on Dynamic Variables

 

Thank you for your patience and I await your response!

Alex

Badge +2

Hi Alex,

 

Items are of the same variant. Here’s a screenshot:

 

Userlevel 7
Badge +58

Hi @jdbrngr , 

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

 

Userlevel 7
Badge +58

Hi @jdbrngr , 

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 @jdbrngr

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