Automattic\WooCommerce\Internal\Admin\Orders

ItemQuantityLimits::below_min_exception │ private │ WC 11.2.0

Build the exception for a quantity below the allowed minimum.

The message is plain text destined for a JS alert, never rendered as HTML: entities are decoded first so stored names read naturally, then any resulting markup is stripped. The name-embedding exceptions in the AJAX handlers apply the same treatment.

Method of the class: ItemQuantityLimits{}

No Hooks.

Returns

\Exception.

Usage

// private - for code of main (parent) class only
$result = $this->below_min_exception( $name, $min ): \Exception;
$name(string) (required)
Product or order item name.
$min(float) (required)
Minimum accepted quantity.

Changelog

Since 11.2.0 Introduced.

ItemQuantityLimits::below_min_exception() code WC 11.3.0

private function below_min_exception( string $name, float $min ): \Exception {
	return new \Exception(
		wp_strip_all_tags(
			html_entity_decode(
				sprintf(
					/* translators: 1: product or order item name, 2: minimum quantity accepted */
					__( 'The quantity of "%1$s" must be %2$s or higher.', 'woocommerce' ),
					$name,
					wc_format_localized_decimal( (string) $min )
				),
				ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401
			)
		)
	);
}