Skip to content

Instantly share code, notes, and snippets.

@michaeldoye
Created June 26, 2015 21:26
Show Gist options
  • Save michaeldoye/e30ca37ad7d11d43caa5 to your computer and use it in GitHub Desktop.
Save michaeldoye/e30ca37ad7d11d43caa5 to your computer and use it in GitHub Desktop.
Custom Add To Cart Messages
/**
* Custom Add To Cart Messages
**/
add_filter( 'woocommerce_add_to_cart_message', 'custom_add_to_cart_message' );
function 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'));
$message = sprintf('<a href="%s" class="button">%s</a> %s', $return_to, __('Continue Shopping &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') );
else :
$message = sprintf('<a href="%s" class="button">%s</a> %s', get_permalink(woocommerce_get_page_id('cart')), __('View Cart &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') );
endif;
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment