Change Continue Shopping Link in WooCommerce

Change Continue Shopping Link in WooCommerce

This case I want to change the location from the original product to the main shop page. You can find that page with the really useful woocommerce_get_page_id function.

Look for the checkbox at Admin page > WooCommerce > Settings > Products tab > Add to basket section: “Redirect to the basket page after successful addition”:

Not checked = stay on page and show “view cart” button

Checked = go to cart page, show cart and show “Continue shopping” button

/*-----------------------------------------------------------------------------------*/
// Skip Product & Cart Pages | Increativeweb
/*-----------------------------------------------------------------------------------*/
add_filter( 'wp_title', 'majestic_wp_title', 10, 2 );
add_filter ('woocommerce_add_to_cart_redirect', 'woo_redirect_to_checkout');
function woo_redirect_to_checkout() {
    $checkout_url = WC()->cart->get_checkout_url();
    return $checkout_url;
}
/*-----------------------------------------------------------------------------------*/
// Return the permalink of the shop page for the continue shopping redirect filter | Increativeweb
/*-----------------------------------------------------------------------------------*/
function my_woocommerce_continue_shopping_redirect( $return_to ) {
    return get_permalink( get_page_by_path( 'individual-camps' ) );
}
add_filter( 'woocommerce_continue_shopping_redirect', 'my_woocommerce_continue_shopping_redirect', 20 );

Jayesh Patel
Author
Jayesh Patel

Jayesh Patel is a Professional Web Developer & Designer and the Founder of InCreativeWeb.

As a highly Creative Web/Graphic/UI Designer - Front End / PHP / WordPress / Shopify Developer, with 14+ years of experience, he also provide complete solution from SEO to Digital Marketing. The passion he has for his work, his dedication, and ability to make quick, decisive decisions set him apart from the rest.

His first priority is to create a website with Complete SEO + Speed Up + WordPress Security Code of standards.



Explore

Related Articles

24th October, 2024

What are the benefits of custom website design and development?

17th October, 2024

White Space Hacks: Make Your Website Shine

9th October, 2024

Maximize Online Growth with Professional SEO Services