Automattic\WooCommerce\Blocks\BlockTypes

ProductButton::get_in_the_cart_textprivateWC 1.0

Get the inTheCartText text for a given product.

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

Хуков нет.

Возвращает

string. The inTheCartText string.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_in_the_cart_text( $product );
$product(WC_Product) (обязательный)
The product.

Код ProductButton::get_in_the_cart_text() WC 11.1.0

private function get_in_the_cart_text( $product ) {
	if ( $product->is_type( ProductType::GROUPED ) ) {
		return __( 'Added to cart', 'woocommerce' );
	}

	return sprintf(
		/* translators: %s: product number. */
		__( '%s in cart', 'woocommerce' ),
		'###'
	);
}