I need to achieve the following:
I have one product in the home page. There is a button to buy that product. When the button is clicked then the product should be added to the cart and the customer should go directly to the checkout page.
I was able to do that using a url ending with /?add-to-cart=productid and a plugin which redirects to checkout page immediately.
However, there is a problem that if the customer clicks the button again then then it doubles the purchases. I tried to limit the purchase by order to one but that resulted that if you click the button again then it’s not going to the checkout page because there is a restriction in the cart. Is there another way to achieve that?