Here’s how to create custom WooCommerce Add to Cart links / buttons and make them add products to cart, redirect to specific pages. This tutorial includes also variable and grouped products, as well as quantities >1.
1) Simple Products: Add to Cart URL
Add One Simple Product to Cart
( https://yourdomain.com/?add-to-cart=282 )
Just copy this link and replace your domain and your product id and paste it into your Button Link or any text link.
Add One Simple Product to Cart with Quantity = 3
( https://exampledomain.com/?add-to-cart=282&quantity=3 )
Just copy this link and replace your domain and your product id and &quantity=3/2 paste it into your Button Link or any text link.
Add One Simple Product to Cart & Redirect to Cart Afterwards
Add One Simple Product to Cart & Redirect to Checkout Afterwards
Remember, for this to work you must tick the “Enable AJAX add to cart buttons on archives” option under WooCommerce –> Settings –> Products -> General and also disable “Redirect to the cart page after successful addition”