Add One Simple Product to Cart
href=”https://yourdomain.com/?add-to-cart=14″
Now, make sure to change the domain name in the link, and the button will work out of the box. 1 product with ID=14 will be added to cart.
Add One Simple Product to Cart with Quantity = 3
href=”https://yourdomain.com/?add-to-cart=14&quantity=3″
1 product with ID=14 and quantity = 3 will be added to cart. Note: you can’t add 2 different products to cart with a URL.
Add One Simple Product to Cart & Redirect to Cart Afterwards
href=”https://yourdomain.com/cart/?add-to-cart=14″
Remember, if you’ve changed the URL for the cart, make sure to change “/cart/” into “/basket/” for example. For this to work you must also tick the “Enable AJAX add to cart buttons on archives” option under WooCommerce –> Settings –> Products -> Display.
Add One Simple Product to Cart & Redirect to Checkout Afterwards
href=”https://yourdomain.com/checkout/?add-to-cart=14″
Remember, for this to work you must tick the “Enable AJAX add to cart buttons on archives” option under WooCommerce –> Settings –> Products -> Display and also disable “Redirect to the cart page after successful addition”:
Add One Simple Product to Cart & Redirect to Any Page Afterwards
href=”https://yourdomain.com/your_custom_page/?add-to-cart=14″
Remember, for this to work you must tick the “Enable AJAX add to cart buttons on archives” option under WooCommerce –> Settings –> Products -> Display and also disable “Redirect to the cart page after successful addition”.