Developer forum

Forum » Development » Notification before product added to cart

Notification before product added to cart

Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Hi,

On my ecommerce-solution, a customer is not allowed to order more than a specific quantity of a product, over time.

In order to achive this, I've added a custom product field, which holds the maximum quantity allowed for each product.
I already check the customers previous orders for the specific product, but I also need to intercept what the customer is about to add to the cart.

I've created a custom NotificationSubscriber, which subscribes to Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.Line.Added, but is it possible to subscribe to a notification before the product is added to the cart, as I would like to give them a warning just after they pressed the button, but before it is added to the cart.

I could set a limit on the quantity-box itself on the product page, but would like to use a NotificationSubscriber instead.

Any ideas?

Best regards
Kurt Moskjaer Andersen


Replies

 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply
This post has been marked as an answer

Hi Kurt,

Your initial description is at server-side. Make the check client-side instead by simply making the check in the template as you suggested yourself. There is no useful notification for what you want to achieve.

 

/Morten

Votes for this answer: 1
 
Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Hi Morten,

Thank you for your answer. I will try the client-side approach.

Best regards
Kurt

 

You must be logged in to post in the forum