Custom notice message and continue Shopping Button Woocommerce

Total 11 users online

Most users ever online were 103, on 18 Sep 2021 @ 7:46 am

Custom notice message and continue Shopping Button Woocommerce

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

  1. Open WordPress admin panel, go to Appearance > Theme Editor 
  2. Open functions.php theme file
  3. Add the following code at the bottom of function.php file
  4. 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<a href="%s" class="button wc-forward">%s</a>', __( 'successfully added to shopping cart.', 'woocommerce' ), esc_url( get_permalink( woocommerce_get_page_id( 'shop' ) ) ), __( 'Continue shopping', 'woocommerce' ) );
else :
    $message = sprintf( '%s<a href="%s" class="button wc-forward">%s</a>', __( '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( '<a href="%s" class="button wc-backword back-btn">%s</a>', get_permalink( woocommerce_get_page_id( 'shop' ) ), 'Continue shopping');
    return $message;
}
				
			
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on skype
Skype
Share on telegram
Telegram
Share on whatsapp
WhatsApp
Share on email
Email
Share on print
Print
Need Help? Chat with me
Please accept our privacy policy first to start a conversation.