I just figured it out for those still wondering! (This may not be the exact way enjoysnacks808 did it in his site, but this just worked on mine)
You need to go to Website Tools>Code Injection> Footer and then paste the code snippet like this:
<script>
document.addEventListener('DOMContentLoaded', (event) => {
// data-item-id ="Enter your data item ID number here"
// If someone enters more than 5, the value will revert to 5.
// Be sure to add instructions for the qty limit in the product description.
const quantityInput = document.querySelector('.product-quantity-input[data-item-id="Enter your data item ID number here"] input[type="number"]'); quantityInput.addEventListener('input', () => {
if (quantityInput.value > 5) { quantityInput.value = 5; }
});
});
</script>
For the data item ID you would enter it like this const quantityInput = document.querySelector('.product-quantity-input[data-item-id="6669115df767f5244f9d1f8d"] input[type="number"]'); where your items actual data-item-id is in " ".
Then you would need to update the numbers in the "if" statement to the max quantity you want to be able to be selected.
Also make sure you have script tags <script> </script> around the code - that's what was breaking it for me. I was just pasting what enjoysnacks808 had posted and it did not work. I added the script tags and it started working.
The only issue I see with this is that yes it allows a max quantity of X (Whatever you set) to be added to the cart at a time, but I can add that max quantity over and over again.
e.g. the code above allows for a max qty of 5, I can add 5 and then once the item is added to my cart I can then click add to cart again and it will add 5 more. I don't think there is a way to limit the amount of times an item can be added to a cart like that (at least that I have found) so while this is a step int he right direction, still not the answer to those of us that need a quantity limit enforced.