Created
October 23, 2017 21:51
-
-
Save joedaniels/f80bcd2a88f0f67616761356761b371e to your computer and use it in GitHub Desktop.
WooCommerce custom added to cart/basket notice message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_to_basket_notice($input) { | |
$input = explode('“', $input); | |
$title = explode('”', $input[1]); | |
$title = $title[0]; | |
$message = sprintf( '%s was successfully added to your basket <a href="%s" class="button">%s</a>', esc_html($title), esc_url(wc_get_page_permalink('cart')), esc_html__('View basket', 'woocommerce')); | |
return $message; | |
} | |
add_filter('wc_add_to_cart_message_html', 'add_to_basket_notice'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment