How to Create a WooCommerce Link to Add a Product to Cart and Redirect to Checkout
So you want to create a link that adds a WooCommerce product of yours directly to a user’s shopping cart and then “encourages” them to checkout by redirecting them to the checkout page. Perhaps you’re holding a special promotion and want to boost sales of a specific item. Minimizing the steps needed to complete checkout can be a great strategy for any online store, especially for products you want to push. This method leads customers to the checkout page without the extra steps of previewing the product page, adding it to the cart, then proceeding to checkout. Just add the following string to your product’s URL:
Remember to replace the yourproducturl.com with your product’s actual URL and to replace the ID with your product’s ID. If you cannot find your product’s ID, make sure you are using a plugin like Simply Show ID’s that will display the ID’s of products, pages, posts, etc. in a separate column (see below).
UPDATE: If you would rather redirect the customer to the cart page, simply replace the “checkout” portion (slug) of the URL with your cart’s slug. For example, http://yourproducturl.com/cart/?add-to-cart=ID. Alternatively, you can redirect your user anywhere on your website by changing the URL before the “?” (http://yourproducturl.com/change-this/?add-to-cart=ID). Remember, for this to work you MUST enable the AJAX add to cart option (under WooCommerce –> Settings –> Products) because the redirect option forces the redirect to the cart page.
Product Variations URL
You can also provide links directly to checkout for variable products.
TIP: Insert your link with the add-to-cart string into a link shortener (i.e. Bitly) for easy use in Twitter or however you’d like to promote the link.