Page 1 of 1

How do I limit cart2 to qty of 1 per product

Posted: Tue Dec 03, 2019 5:17 pm
by blackrain
I want to limit the quantity of items per SKU

e.g A user clicks on a product twice, and the cart only accepts 1 not 2 of the same product.

I want to limit users but querying the cart to see if the cart os holding a sku the turn the 'add item' button for that specific product off or disable it.

thanks

Re: How do I limit cart2 to qty of 1 per product

Posted: Wed Dec 04, 2019 3:46 am
by iturbay
after clicking on the add to cart button using javascript add the disable attribute to it

Re: How do I limit cart2 to qty of 1 per product

Posted: Wed Dec 04, 2019 7:09 am
by blackrain
In the first instance javascript offers a solution that works well for double click, but I am looking for a more logic based approach that looks at the items in the basket, then disables the button of the relevant products.

If I used javascript alone the buttons would be re-enabled on refresh or page load.

Thanks for the suggestion.