Jump to content

[SOLVED] Limit products quantity in cart Prestashop 1.6


Recommended Posts

Thanks for your help, but not helped me. 

 

I need no ORDER quantity. I need that users can't ADD products in cart more than 20 or not more than amount of currency. 

 

I need it to stop some users and bots to ADD products to cart for more than 10 or 20 pcs. 

Link to comment
Share on other sites

You want to limit the total amount of all products that can be added to the cart?

Lets say 20 Maximum:

5 x Product a

8 x Product b

7 x Product c

 

or just 20 x Product a

or 10 x a and 10 x b

right?

Same is possible for total amount.

Then look into the Link I gave you. Im pretty sure the module can do this. Its not mentioned in the first post but later on.

 

Also if you want to stop robots from creating carts there is a better solution. LINK

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

Okay so I just tried it myself this solution LINK  post #7 works with 1.6.0.9.

A costumer only can add a maximum of 20 items into the cart.

You need to change the number here

if ($this->context->cart->nbProducts() > 0) 

should be

if ($this->context->cart->nbProducts() > 19) 

and change this message to what you would like to have there

 $this->errors[] = Tools::displayError('Only twenty products per order are allowed. Please continue to checkout');
            }
Edited by thepan (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 4 years later...
  • 1 year later...

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...