Developer forum

Forum » Development » Merge cart line criteria

Merge cart line criteria

Marco Santos
Reply

Hello.

I am trying to add an additional field to be considered in cart lines merging. If I add a new line to my cart and there is already a line for that product/variant in the cart the amounts for the order will be updated, rather than creating a new line. What I need to happen is to change the merge criteria so it considers a cart line custom field also. So if I add two lines, one with Product1/Variant3/Available and quantity 2, and Product1/Variant3/20150608 with quantity 3, this would create two lines in the cart, rather than the one for Product1/Variant3 with quantity 5.

How would you go about doing this? Can I do it through settings only or do I need to develop some custom behaviour somewhere?

Thank you.

Marco

 


Replies

 
Nicolai Høeg Pedersen
Reply
Hi Marco
There is a concept of orderline fields - that must be what you mention as custom fields?
If you add the same product with different order field values, 2 lines are added even if product and variant id is the same.
Is it a service, bom or stock product you add?
BR Nicolai
 
Marco Santos
Reply

Hello.

It's a product. I have been trying to add the value when adding to the cart, but without success. I am using the system name as the name for the parameter that is sent (in this case stockDate), but that might not be all. Is there a pattern that must exist for the parameter name, or for text inputs, as is this case?

Marco.

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Marco

Check out this page http://manual.dynamicweb-cms.com/Dynamicweb-On-line-Manual/Management-Center/eCommerce/Orders/Order-line-fields/How-to-use-order-line-fields.aspx

Follow the link to the template tag reference. That should help you.

BR Nicolai

Votes for this answer: 1
 
Marco Santos
Reply

One more question regarding this: I have been able get the behaviour I want in a simple example, where I am adding from the product page. I was not able to do the same with an example where I am adding multiple products (with addMulti) and which uses context carts. Can anyone confirm that this functionality will still work for these cases? I suspect that the fact that context carts are being used has no impact, and that the only difference for the multiple is that the order field parameter will need to be adjusted, as per the details in the Shopping Cart Module documentation.

 

You must be logged in to post in the forum