WooCommerce Cheatsheet

Add to cart URLs with redirects

Hiding a single product from search & catalog

Add to cart URLs with redirects

WooCommerce has a lot of powerful built in features for adding products to the cart and redirecting elsewhere afterward, but I always have a heck of a time finding them in the documentation. Here are the most useful:

Redirect to to the art after adding: https://yourdomain.com/cart/?add-to-cart=25&quantity=1

Redirect to the checkout page after adding: https://yourdomain.com/checkout/?add-to-cart=25&quantity=1

Product variations: Use the same structure as above, but each variation has its own ID. Check the Variations tab of the product edit screen.

Grouped products or more than one product: https://yourdomain.com/?add-to-cart=3111&quantity[1803]=5&quantity[1903]=2

Redirect to any page after adding to the cart: https://yourdomain.com/your_custom_page/?add-to-cart=25&quantity=1

Note: If you cart or checkout page has a non-standard slug, you’ll need to change /cart or /checkout above. Also, generally for this to work you must check the “Enable AJAX add to cart buttons on archives” option under WooCommerce –> Settings –> Products -> General and disable “Redirect to the cart page after successful addition”.

Hiding a single product from search & catalog

On the product edit page in the classic editor, there is a Catalog Visibility option in the Publish meta box. You can set this to Hidden to hide a product from the catalog and search. This meta option is not visible in the Block editor yet, but you can toggle the option under the Quick Edit menu on the all products screen in wp-admin.