Skip to content

Instantly share code, notes, and snippets.

@SiR-DanieL
Created March 16, 2016 11:09
Show Gist options
  • Save SiR-DanieL/aff1a0a75846b6998717 to your computer and use it in GitHub Desktop.
Save SiR-DanieL/aff1a0a75846b6998717 to your computer and use it in GitHub Desktop.
/**
* 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