-
-
Save WPDevHQ/c6c9dac4de8ef6814125992d24755c06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Redirect to a specific page when clicking on Continue Shopping in the single product page | |
* | |
* @return void | |
*/ | |
function wc_custom_redirect_continue_shopping( $message ) { | |
if ( strpos( $message, __( 'View Cart', 'woocommerce' ) ) !== false ) { | |
$message = str_replace( esc_url( wc_get_page_permalink( 'cart' ) ), esc_url( wc_get_page_permalink( 'shop' ) ), $message ); | |
$message = str_replace( __( 'View Cart', 'woocommerce' ), esc_html__( 'Continue Shopping', 'woocommerce' ), $message ); | |
} | |
return $message; | |
} | |
add_filter( 'wc_add_to_cart_message', 'wc_custom_redirect_continue_shopping' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment