Skip to content

Instantly share code, notes, and snippets.

@joedaniels
Created October 23, 2017 21:51
Show Gist options
  • Save joedaniels/f80bcd2a88f0f67616761356761b371e to your computer and use it in GitHub Desktop.
Save joedaniels/f80bcd2a88f0f67616761356761b371e to your computer and use it in GitHub Desktop.
WooCommerce custom added to cart/basket notice message
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