Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Last active May 31, 2016 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BFTrick/1508c837d8ef54b43fe175d27057e5d9 to your computer and use it in GitHub Desktop.
Save BFTrick/1508c837d8ef54b43fe175d27057e5d9 to your computer and use it in GitHub Desktop.
Redirect to a specific product category after a product is added to the cart
<?php
add_filter( 'woocommerce_add_to_cart_redirect', 'patricks_custom_cart_redirect' );
function patricks_custom_cart_redirect() {
// our prodcut category ID
$product_cat_id = 10; // replace this number with your category ID
// redirect to the page
return get_term_link( $product_cat_id, 'product_cat' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment