Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

Prevent setting the quanity higher than the quantity of a product in stock?

Started by OneMore, February 27, 2024, 01:11:36 PM

Previous topic - Next topic

OneMore

Hello,

I plan selling mostly unique (spare) parts, and items in small quantities, and without quantity discounts, nor priced options.

On the product page, how can one prevent setting a quantity higher than the inventory level being added to the cart?
I would like to control the quantity enterd in the quantity field, as well as disable the "Add to cart" button if the quantity already in cart
plus the quantity mentioned are above the inventory level.

Exploring the source code with the browser development tools, the field is:
Quote<input type="text" name="quantity" id="product_quantity" value="1" placeholder="" class="form-control short" size="3">

If the number of a given product in stock is 3, I would like to modify it to:
Quote<input type="number" min="0" max="3" name="quantity" id="product_quantity" value="1" placeholder="" class="form-control short" size="3">

Doing a grep search,I could find the "product_quantity" string only in ".../templates/embed/js_product.tpl", but modifying the code there was without effect, even after clearing the cache.

So far, I could not find where in the code the "product_quantity" field is generated ...  :-[
Who can help?

dickinsonron

Your best bet for getting the inventory control features you desire for your e-commerce website is to either modify your site's code or install a plugin/module that provides it.

Forum Rules Code of conduct
AbanteCart.com 2010 -