Add to Cart Only Once

Hi, Is there a way to limit how many times a user can add an item to the cart?

Currently, they can keep clicking the “Add to Cart” button and add multiple quantities of a digital product. I’d prefer that once the item is added to the cart the button updates to a permanent “Added to Cart” state.

Thanks!

1 Like

You could probably use some custom code to override the button to achieve this.
I’ve implemented an alternative solution (because of multiple limit requirements) in the cart itself. In my solution it displays an error and prevents checkout until you modify the cart contents.

1 Like

I have this same question for digital downloads.

There doesn’t seem to be a way to add a cart limit for digital files (which should typically max out at 1 in the cart).

1 Like

How has this still not been fixed, it is a ridiculous oversight. It makes the built in ecommerce basically useless for digital goods without some really janky workarounds. Why does every Webflow feature have some glaring omission that they refuse to fix.

1 Like

I’m facing exactly the same issue and i agree with the fact this is quiet the oversight! Do someone has some tips on the workarounds available ?

@4.30Pm you should be able to construct a solution that accomplishes this, however it will require a bit of custom code.

Here’s the path I’d try;

  • Give all of your digital products a Product Type of Digital, to make them easily identifiable. These are the items we’re going to restrict quantity on.
  • On your product page, checkout page, and cart, select the product quantity field and filter it so that it only appears when the Product Type is NOT Digital. Just easier that way. We want to prevent people from changing the quantity, and this is the simplest way.
  • On your product page, you want to prevent another click on the Add to Cart button. Even with the quantity field hidden, it would get incremented. So we want to hide that button if the quantity is 1. That part will need to be done by script, activated on page on load, and also on button click.

That should do the trick. With this approach it really doesn’t matter how Webflow has implemented the cart in the commerce library, because you’ve closed it down at the UI layer. Users simply cannot add more than 1 item for anything digital.

Getting that code smooth may require a bit of fiddling, but if it’s done right I don’t think you’ll need to trigger a quantity update in the cart logic. PM if you need some dev assistance.

1 Like

Hello Memecitan, Thank you for your help!

I understand the idea ! Do you think that it’s possible to make the “add button” hidden when the quantity button is one and at the same remplace the " add button" by a message that say something like " already in your cart " so that the user don’t don’t think that there is an issue on the page?

Yes, in fact that’s the right way to do it.
Your scripts would look something like this…

  1. An Update controls method checks the hidden quantity field. IT it is > 0 AND the product type == digital, hides the “add” button, and shows the “already in cart” message.
  2. On page load, the update controls method is called. That way, a re-entry into the page is set properly.
  3. On button click of the Add to cart button, also triggers the update controls method.

Hi Memetican , Sorry for the delay.
Awesome thanks a lot. If your offer is still on, i will be glad to receive your help with it because while i understand the fundamentals, i don’t know how to concretely build it!

Hi Memetician, 4.30Pm - any chance you managed to create this script, and if so please could you share it with me as I have a similar obstacle!

Thanks

Hey Joe, I have not, I don’t have any current live Webflow Commerce projects running where I need that feature, or where I can test the cart portion. I offered to 4:30 to do a few hours of coding to build & test a solution if needed. PM me if you are interested and want to discuss that.

I have this same question for digital downloads. here what’s about security services..

Hi all.
Josh with Foxy here. Limiting how many times a specific product/sku can be added to cart is a standard feature with our seamless Webflow integration: https://foxy.io/webflow

Please don’t hesitate to reach out if you have any questions or need help getting started: hello@foxy.io

Thanks,
Josh