I’m currently setting up an e-commerce site with 1 single item for sale. We are only allowing 1 item per order due to limited quantities available.
I’m trying to add some custom code that will either prevent someone from checking out (error message) and/or force the quantity before checkout.
I know you can hide the quantity selector, which will prevent someone from modifying the quantity, but that’s not going to prevent someone from closing the cart and adding another item before checking out.
Ideally, I’d like some logic on the page to check the current cart quantity. If the quantity is 0, add the item. If it’s greater than 0, set it to 1. Something along those lines should work but I’m not sure how to target the elements on the page or intercept when these calls are made or where to inject the code.