skip to Main Content

WordPress Code Snippets


Custom Redirect After Add to Cart in WooCommerce

Learn how to set up a redirect to a specific page after users add items to their cart in your WooCommerce store.

// Redirect to a custom page after adding to cart
add_action( 'woocommerce_add_to_cart', 'codebykp_custom_redirect_after_add_to_cart' );
function codebykp_custom_redirect_after_add_to_cart() {
    wp_safe_redirect( home_url( '/custom-page' ) ); // Change to your desired page
    exit;
}

I’m a WordPress developer with 10+ years of experience in WooCommerce and custom plugins. I combine technical expertise with design flair to help you create standout, user-friendly websites. Let’s transform your digital presence!

Best WordPress Hosting
Back To Top
Search