Are you looking for a way to change the default notice when product “Added to cart” in WooCommerce? and you can add “Continue Shopping” button
STEPS TO CHANGE DEFAULT NOTICE TEXT
- Open WordPress admin panel, go to Appearance > Theme Editor
- Open functions.php theme file
- Add the following code at the bottom of function.php file
- Save the changes and check your website. The custom text in add to cart button should show up now.
function your_add_to_cart_message() {
if ( get_option( 'woocommerce_cart_redirect_after_add' ) == 'yes' ) :
$message = sprintf( '%s%s', __( 'successfully added to shopping cart.', 'woocommerce' ), esc_url( get_permalink( woocommerce_get_page_id( 'shop' ) ) ), __( 'Continue shopping', 'woocommerce' ) );
else :
$message = sprintf( '%s%s', __( 'successfully added to shopping cart.' , 'woocommerce' ), esc_url( get_permalink( woocommerce_get_page_id( 'cart' ) ) ), __( 'Continue shopping', 'woocommerce' ) );
endif;
return $message;
}
add_filter( 'wc_add_to_cart_message', 'your_add_to_cart_message' );
add_filter( 'wc_add_to_cart_message_html', 'my_custom_add_to_cart_message' );
function my_custom_add_to_cart_message( $message ) {
$message .= sprintf( '%s', get_permalink( woocommerce_get_page_id( 'shop' ) ), 'Continue shopping');
return $message;
}