Skip to content

Instantly share code, notes, and snippets.



Last active May 31, 2016
What would you like to do?
Redirect to a specific product category after a product is added to the cart
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
You can’t perform that action at this time.