Developer forum

Forum » Ecommerce - Standard features » Cant add products with different variantIDs

Cant add products with different variantIDs

Andreas Pettersson
Reply

Hi,

I have a product with different variants. When I add the first variant I get the column OrderlineProductvariantId to VO6.VO8 in EcomOrderLine table in DB. But if I add another variant of the same product it overrides it and just add quantity to 2 instead of a totally new row which it should be because it has a new variantId? 

So now my orderline has OrderlineProductvariantId VO4.VO8 for example. 

Im using: <input type="hidden" name="VariantId" value="" /> this one to add my VariantID before post with cartcommand add. 

Variant1.PNG Variant2.PNG

Replies

 
Nicolai Pedersen
Reply

Can you show us the entire form for adding to cart? Including your cartcmd value. And maybe a screenshort of the request in dev tools.

And also please specify your DW version.

Thank you for clarifying.

BR Nicolai

 
Andreas Pettersson
Reply

Hi,

We run dw version 9.12.3. 

The url we send is like this: https://skanskaweb.local/produkter?cartcmd=add&productid=PROD92&variantid=VO4.VO15

Regards
Andreas

 
Nicolai Pedersen
Reply

Hi Andreas

I cannot reproduce that.

Are you sure there is only one orderline? I cannot see the orderlineid on the screendump you made. But orderline date is different in the 2 things you show which indicates that it is different orderlines. Do you have a select top 1 or something?

 
Andreas Pettersson
Reply

Hi,

For the first item 

  1. quantity:
    1
  2. productprice:
     
  3. productid:
    PROD94
  4. cartcmd:
    add
  5. redirect:
    false
  6. tariffDay:
    st
  7. VariantId:
    VO6.VO8

    For the second item:
  8. quantity:
    1
  9. productprice:
     
  10. productid:
    PROD94
  11. cartcmd:
    add
  12. redirect:
    false
  13. tariffDay:
    st
  14.  
    VariantId:
    VO4.VO8

This is from Form data in devtools.

It overrides the orderline in EcomOrderlines table in DB. I have order the list by orderlinedate. Or remove the old and add a new as you can see. I just did a refresh on my SQL query. 

So this is the first item: 

 

When i  now add the second variant it "removes" the old and add the new: 

Orderlinequantity is now 2

 
Nicolai Pedersen
Reply

Yes, it removes the old orderline and adds a new orderline. Otherwise it would have same orderlineid.

Maybe you have some custom code? tarrifDay is not DW specific parameter so maybe you have some code that handles that information that accidently does something that removes the orderline?

 
Andreas Pettersson
Reply

Hi, 

I think we have found the issue in our code, we have some cartsubscribers with custom code. Thank you for your time.

Have a nice holiday.

Regards
Andreas

 

You must be logged in to post in the forum