Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search

restricting the amount of item in one command

Recommended Posts

Site URL: https://www.crusetdecouvertes.fr

Hello, i'm setting up an eshop for natural wine in France. As we are proposing very special wine from small producers with small production , we want to limit the quantity that one client can order, to avoid someone to take all the bottles in one command, and allow more customers to experience this wine. I check in eshop options and can just lowered the stock amount which doesn't reach my needs. Do you have any solution for that ? thanks in advance

Link to post
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

You could purchase custom code to enforce a maximum order quantity on the product page and/or in the cart, but the benefit of this will be lost at the checkout stage where you cannot continue to enforce the limit.

This is because Squarespace allow customers to edit the quantity on the checkout page (see yellow box on screenshot), and we are prevented from adding code to the checkout page to prevent this.






Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include.
Explore our range of Squarespace Extensions, including the Wishlist, Variant Availability and Datepicker Extension
Note that links in my posts may be affiliate links. Need personal help? 
Book a Squarespace Expert.

Link to post
  • 3 weeks later...

You can do this using JavaScript. Insert the below code using code injection within the product page. As @Paul2009 said, this won't prevent people from adding the max amount multiple times, or changing the number in the shopping cart, but it prevents people from adding more than the max via the product page's add-to-cart function. 

Product page > Additional info > Code injection > [insert below] > Save

  document.querySelectorAll("input")[0].setAttribute("max", "#"); 

Change "#" to whatever number to be.  For example, if you don't want customers to be able to buy more than 3, your code would be:

  document.querySelectorAll("input")[0].setAttribute("max", "3"); 

Hope this helps!


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...