Jump to content

Forcing Quantity to 1 with Limited Quantity & Quantity for Services Enabled

Recommended Posts

Hello,

I run a hockey camp where I have a series of clinics, and each clinic can have up to 20 players.  I would like to set up a store that shows each clinic and the number of spots available as shown on this page: https://www.lvlup-hockey.com/hockey-clinics-buffalo

The issue with this is I only want each customer to only be able to sign up for the clinic once (quantity of 1 per customer)

As of now, I have my products set up as a service.  The easy option would be to disable "Quantity for Services" in Settings/Selling/Checkout; however, when you do that, you cannot display the remaining quantity as enabled in selling/selling tools/product status/limited quantity.

To display the quantity, I cannot disable quantity per service.

I was able to inject this code which prevents users from increasing quantity on the product page, but I need to prevent users from clicking the "add to cart" button multiple times or increasing the quantity in the cart. 

<script>
        document.addEventListener('DOMContentLoaded', () => {
            var qty = document.querySelector('input[type="number"]');
              qty.setAttribute('max', '1'); 
        });
</script>

 Any help would be greatly appreciated.

Link to comment
  • Replies 4
  • Views 659
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

20 hours ago, jlines said:

I need to prevent users from clicking the "add to cart" button multiple times or increasing the quantity in the cart. 

Do you want to stop users accidentally adding more than one, or do you need to prevent them adding more than one?

The latter isn't possible because users will always be able to amend the quantity on the checkout page.

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Link to comment

Thanks for your help, Paul.  I'm open to any solution that will allow me to show the available quantity remaining while at the same time limiting the customer to 1.  

The "Quantity Remaining" not displaying when" Quantity for Services" is turned off dynamic is making this tough.

Is there a script similar to what's shown in my intial post that will prevent users from updating the quantity in their cart?  

On the store page itself, after clicking the "Add to Cart" button a message triggers saying "Added."  The only issue there is after a couple of seconds, "Added" disappears then goes back to "Add to Cart".  Is there a script that can keep the button status as "Added"

I think those 2 scripts would solve the problem.

 

is there a script that will just

Link to comment
3 hours ago, jlines said:

Is there a script similar to what's shown in my initial post that will prevent users from updating the quantity in their cart?

As I mentioned above, you cannot prevent someone changing the qty on the checkout page. This page is locked down and cannot run custom code.

This can make it feel futile when trying to prevent changes in the earlier stages of the purchase workflow. Whatever you do, they’ll be able to override it at checkout. 

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Link to comment

Create an account or sign in to comment

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

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.