Automattic\WooCommerce\Internal\Admin\Orders
ItemQuantityLimits::below_min_exception
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.
Метод класса: ItemQuantityLimits{}
Хуков нет.
Возвращает
\Exception.
Использование
// private - только в коде основоного (родительского) класса $result = $this->below_min_exception( $name, $min ): \Exception;
- $name(строка) (обязательный)
- Product or order item name.
- $min(float) (обязательный)
- Minimum accepted quantity.
Список изменений
| С версии 11.2.0 | Введена. |
Код ItemQuantityLimits::below_min_exception() ItemQuantityLimits::below min exception WC 11.2.2
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
)
)
);
}