Automattic\WooCommerce\Blocks\BlockTypes

ProductButton::get_in_the_cart_textprivateWC 1.0

Get the inTheCartText text for a given product.

Method of the class: ProductButton{}

No Hooks.

Returns

String. The inTheCartText string.

Usage

// private - for code of main (parent) class only
$result = $this->get_in_the_cart_text( $product );
$product(WC_Product) (required)
The product.

ProductButton::get_in_the_cart_text() code WC 10.7.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' ),
		'###'
	);
}