Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the mrshafaq domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/tuwqiaec/mrshafaq.com/wp-includes/functions.php on line 6114
⚡Ⓢ⚡ Custom notice message and continue Shopping Button Woocommerce - MrShafaQ

Custom notice message and continue Shopping Button Woocommerce

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;
}
				
			

Subscribe to get latest updates !