Developer forum

Forum » Development » eCom: ProductID in cart

eCom: ProductID in cart


Reply

Hi DW-Experts ;)

 

Can anyone provide me with an example of how to get hold of the products added to the cart by a customer. I need the data (actually only ProductID for the last added product) for use in a Custom Module that shows related products based on custom features on the added product.

 

 

/Morten

 


Replies

 
Reply

The Dynamicweb.Notifications.eCommerce.Cart.Line.Added lets you know when a product is added to the cart. The associated Dynamicweb.Notifications.eCommerce.Cart.Line.AddedArgs object provides you with information of the product added among other things.

 

If you'd like to use the information other places, like a PageTemplateExtender, you can find the current cart (Order object) in Dynamicweb.eCommerce.Common.Context.Cart. In the OrderLines choose the last entry to find the last added item.

 

 

You must be logged in to post in the forum