Maximum Order Quantity

I’m looking for help in limiting individual orders from including more than 3 items. Is there a way to either limit the max quantity of a given product or create a max total items in an order?

Hey Jesse, welcome to the community =]

This should cover the Add Product Page:

    var qinput = document.getElementById("quantity");

I’ll update with the cart end of things.

Here is the final code I came up with, which should set limits on any orders with a single product type.

Just stick it in your Shopping Cart Theme’s “Custom Footer”:

	// set limit for input field
	var limit = 3;

	// get product page quantity
	var qinput = document.getElementById("quantity");
	// get checkout qty
	var cartqinput = document.getElementsByName("qty_1");


	function setLimitOnAttr(attr) {
		// if it's not set, exit
		if (!attr) { return; }

		// set to number type field
		// set max value to limit
		attr.setAttribute("max", limit);

Let me know if you have any questions!


It works! Thanks MEarl!

1 Like