Tag: Shopping cart

WooCommerce: Add custom Add To Cart Message & Custom “Continue Shopping Link”

Add this code in function.php

 

<?php

/**

* Custom Add To Cart Messages

* Add this to your theme functions.php file

**/

add_filter( 'wc_add_to_cart_message', 'woocommrece_custom_add_to_cart_message' );

function woocommrece_custom_add_to_cart_message() {

global $woocommerce;

 

// Output success messages

if (get_option('woocommerce_cart_redirect_after_add')=='yes') :

 

$return_to = get_permalink(woocommerce_get_page_id('shop'));// Give the url, you want to redirect

 

$message = sprintf('<a href="%s">%s</a> %s', $return_to, __('Continue Shopping &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') );

 

else :

 

$message = sprintf('<a href="%s">%s</a> %s', get_permalink(woocommerce_get_page_id('cart')), __('View Cart &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') );

 

endif;

 

return $message;

}

/* Custom Add To Cart Messages */

?>
Advertisements