WC_Product_Simple::add_to_cart_success_message()publicWC 1.0

Get the add to cart button success message - used to update the mini cart live region.

Method of the class: WC_Product_Simple{}

Return

String.

Usage

$WC_Product_Simple = new WC_Product_Simple();
$WC_Product_Simple->add_to_cart_success_message();

WC_Product_Simple::add_to_cart_success_message() code WC 9.4.2

public function add_to_cart_success_message() {
	$text = '';

	if ( $this->is_purchasable() && $this->is_in_stock() ) {
		/* translators: %s: Product title */
		$text = __( '“%s” has been added to your cart', 'woocommerce' );
		$text = sprintf( $text, $this->get_name() );
	}

	/**
	 * Filter product add to cart success message.
	 *
	 * @since 9.2.0
	 * @param string $text The success message when a product is added to the cart.
	 * @param WC_Product_Simple $this Reference to the current WC_Product_Simple instance.
	 */
	return apply_filters( 'woocommerce_product_add_to_cart_success_message', $text, $this );
}