simpleCart quantity increment

I have a product table in my sql database with one of the fields named productQuantity. I am using simpleCart which saves alot of manual coding. One such feature is the simpleCart.increment which increases the quantity of the item in the cart.

However I am now having an issue of whereby if there is 5 items in stock the increment goes pass the 5th item.

How do I limit the customer from increasing the quantity if the customer wants to purchase all five items and for example mistakenly increments to 6 items.

After you increment, check if it’s too much.

if (quantity > itemCount) {
  quantity = itemCount;
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.