I use WooCommerce in many projects and often I need to modify something to obtain what I want. Sometimes I need to create custom WooCommerce Add to Cart HTML links / buttons and make them add one or more products to cart and redirect to specific website pages.
Fortunately, it is very easy.
First you have to find the ID of the product you need to join to your button (look the imagine here)
URL: Add One Simple Product to Cart
Remember to change the domain name in the link, and the button will work out of the box. 1 product with ID=22 will be added to your cart.
URL: Add One Simple Product to Cart with Quantity = 5
1 product with ID=22 and quantity = 5 will be added to your cart.
URL: Add One Variable Product to Cart
The Variation ID (88 in my smple) you’ll find in the “variation” page.