woocommerce_product_add_to_cart_success_message
Filter product add to cart success message.
Usage
add_filter( 'woocommerce_product_add_to_cart_success_message', 'wp_kama_woocommerce_product_add_to_cart_success_message_filter', 10, 2 ); /** * Function for `woocommerce_product_add_to_cart_success_message` filter-hook. * * @param string $text The success message when a product is added to the cart. * @param WC_Product_Simple $that Reference to the current WC_Product_Simple instance. * * @return string */ function wp_kama_woocommerce_product_add_to_cart_success_message_filter( $text, $that ){ // filter... return $text; }
- $text(string)
- The success message when a product is added to the cart.
- $that(WC_Product_Simple)
- Reference to the current WC_Product_Simple instance.
Changelog
Since 9.2.0 | Introduced. |
Where the hook is called
woocommerce_product_add_to_cart_success_message
woocommerce/includes/class-wc-product-simple.php 99
return apply_filters( 'woocommerce_product_add_to_cart_success_message', $text, $this );