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.

Метод класса: WC_Product_Simple{}

Возвращает

Строку.

Использование

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

Код WC_Product_Simple::add_to_cart_success_message() WC 9.3.3

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 );
}