How to limit quantity on Product

To limit quantity on Product Squarespace, you can follow these.

#1. One Product

First, you need to find Product ID.

In my example, it is: #item-674d9b1537f5e2577fa97006

Next, use this code to Code Injection > Footer

<script>
document.querySelectorAll('#item-674d9b1537f5e2577fa97006 .product-quantity-input input').forEach(input => {
  input.value = 1;
  input.setAttribute('readonly', true);
  input.style.pointerEvents = 'none';
});
</script>

Remember to change Product ID in the code.

This code will set Quantity always show 1. Users can’t increase it.

You can change 1 to another number.

#2. Some certain products

You can create a tag with name: limit-quantity and assign it to products.

Next, use this code to Code Injection > Footer.

<script>
document.querySelectorAll('.tag-limit-quantity .product-quantity-input input').forEach(input => {
  input.value = 1;
  input.setAttribute('readonly', true);
  input.style.pointerEvents = 'none';
});
</script>

1 Like