Skip to content

Instantly share code, notes, and snippets.

@BFTrick

BFTrick/functions.php

Last active May 31, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.