Maximum Order Quantity 
Autore: Steve J.
Visite 123,
Followers 0,
Condiviso 0
Currently in Product Settings I can specify a Minimum Order Quantity. Is there anyway of setting a Maximum order quantity?
SteveJ
Postato il
... you might find something interesting here:
>> https://helpcenter.websitex5.com/it/post/239705
...if you want to learn more, post your link...
.
ciao
.
Autore
Thanks
Tried the script solution but theres too many holes in the site and I can get passed the 2 item limit I set.
The final solution wouldnt work for ma as I use the availability function for warehouse management.
SteveJ
...maybe I didn't understand, ...but in theory this shouldn't happen if the code were applied to all sections...
...in that case, you'll have to wait for other suggestions...
.
ciao
.
Autore
I'd have to add it in for every product. Is there any way of making it global for all products?
SteveJ
yes, I'm out, I'll be back tomorrow, bye, ciao
(It > En) ... ... you didn't post the LINK to make the evaluations...
... however, based on the site page in your profile, my code for the SHOP catalog page for a maximum of two units per product is this:
<script>
/** MAX unità scheda prodotti x WSx5 by KolAsim **/
$(document).ready(function () {/*K>*/ function avviaControlloQuantità() {/*K1>*/ $(".im-cc-products-qty").each(function () {/*K2>*/ $(this).off("click").on("click", function () {/*K3>*/ if ($(this).val() > 2) {/*K4>*/ alert("Attention!\nMAX 2 units per product"); $(this).val(2); }/*K4<<*/ });/*K3<<*/ });/*K2<<*/ }/*K1<<*/ if ($(".im-cc-products-card").length > 0) {/*K5>*/ avviaControlloQuantità(); }/*K5<<*/ else {/*K6>*/ const observer = new MutationObserver(function (mutations, obs) {/*K7>*/ if ($(".im-cc-products-card").length > 0) {/*K8>*/ obs.disconnect(); avviaControlloQuantità(); }/*K8<<*/ });/*K7<<*/ observer.observe(document.body, {/*K9>*/ childList: true, subtree: true });/*K<<9*/ }/*K6<<*/ });/*K<<*/
</script>
------------------------------------
.
ciao
.
... then, in my opinion, I think that another invention of mine should be applied, to influence the changes in the /CART section, as you can see in this simulation of mine:

.
ciao
.
Hello
Here on mydemo
https://wsx5demo.afsoftware.fr/boutik.php
I have already an example from KolAsim
to control the minimium of quantity.
So with the same code just by changing the value by >maxK it works to control the maximum
<script>
/** -- x CART controllo quantità prodotti by KolAsim -- **/
$( document ).ready(function() { //K>:
ritardoK=1; // Delay in seconds before to be controlled... reduce it to avaid a quick click on the proceed button
minK=2; //... Minimum value of products into the cart ...
maxK=5; //... Maximum value of products into the cart ...
setTimeout(function(){ //K1>;
divK1='<div id="div_K1" ><div id="div_K2" title="Procéder >>" > </div></div>'; // Here change the label of the button
$("#cart-container .btn-next").append(divK1)
$("#div_K2").click(function(){ totaleProdottiK() })//K2>|<<
$("#div_K1").hover( function() {//K3>
$(".btn-next input").addClass( "hover" ); // via Chrome Inspect check the type of btn-next : here it is an input
}, function() {$(".btn-next input").removeClass( "hover" ); // via Chrome Inspect check the type of btn-next : here it is an input
});//K3<<
}, ritardoK * 1000); //K1<<;
}); //K<<;
//---------K--------------------------------------
function totaleProdottiK() {//K4>
TotKx=parseInt($(".s-cell-desc").text()); //alert(TotKx)
if(TotKx <minK){ //K5>
// alert("\u2713 Attention!\nPurchase at least two (2) Products\n\nThank you!");
alert("\u2713 "+ toUnicodeVariant('ATTENTION !', 'bold sans', 'bold')+ "\nPurchase at least " + toUnicodeVariant('TWO', 'bold sans', 'bold')+ " (2) Products\n\nThank you!");
}
else {
setTimeout(function(){
$(".btn-next input").click() // via Chrome Inspect check the type of btn-next : here it is an input
}, 500);
}//K5<<
}//K4<<<
</script>
<!-- End of To control number of products into the cart before to go to the payment -->
Put the code here
Axel