Jump to content

How can I forbid to add new products in cart when product X is in cart?

Carlos Mir

Recommended Posts

How canI disable to add new products in cart if the cart has a product with id=x?

I have read some forum discussions but nothing for my case.

I have some products example ids=["3","12","19"] and these products are delivered by the provider. So I want if a customer wants to buy product 3 and product 5 the cart only accepts products inside ids array or outside the array. So the client must buy that products on differents orders. There are some other restrictions with these different groups like payment method.

But my issue is what archive I have to modify to  check if the new product added to the cart is in that array or not to forbid to add the product and maybe show an alert to the user.

I have checked ajax-cart.js and Cart.php but I have not seen any solution.


How can I accomplish that?


P.S.: My prestashop version is

Edited by Carlos Mir (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...