Setting Minimum or Maximum Item Quantities for ShopCart
Posted by Doug Sherman (Import), Last modified by Doug Sherman on 04 Mar 14 10:57 AM
You can see quantity min/max control in action here.
Here are the steps to follow:
1.Modify our current opening form tag for each item you want to limit, and set the min and/or max limit in the onsubmit code, ie, change:
<FORM ACTION="http://www.auctioninc.com/cart/" ENCTYPE="application/x-www-form-urlencoded" METHOD="post">
2. Second, you must expose our quantity field, so that your customer can enter the quantity on your product page rather than in our cart. This is a simple matter of changing the "TYPE" our "quantity" form field in your Add to Cart html from "hidden" to "text", ie, from:
That will "expose" a text box on your product page next to the Add to Cart button. You should add a label to it so that your customer knows what it is for.
Also, to prevent quantity from being editable in the cart, change the value of the "undefined_quantity" form field from "1" to "0":
NOTE: AuctionInc also supports setting quantity discounts, as described in this article. You can combine both functionalities by:
2) Tweaking the other form fields as described in the article;
An example of combining calls for both would be:
<FORM ACTION="http://www.auctioninc.com/cart/" ENCTYPE="application/x-www-form-urlencoded" METHOD="post" onsubmit="SetAmt(1, 10, 5, 9, 10, 8); maxqty = 10;minqty = 3; if (!ChkQty (this))return false; return ReadForm(this)">