Automattic\WooCommerce\Enums

ProductStockStatus::get_all │ public static │ WC 10.9.0

Returns every stock status value defined by this enum, as a flat list.

It is wider than the set of statuses products store. self::LOW_STOCK is a reporting aggregate: the Analytics stock report counts in-stock products whose quantity has fallen to their low-stock threshold, so a low-stock product stores self::IN_STOCK. That report adds self::LOW_STOCK to its own enum for exactly that reason.

WC_Product::set_stock_status() coerces anything outside wc_get_product_stock_status_options() to self::IN_STOCK, so use that helper for values you intend to store or filter on. It returns a value => label map rather than a list, and being filterable it also carries statuses an extension added.

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

Хуков нет.

Возвращает

string[].

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

$result = ProductStockStatus::get_all(): array;

Список изменений

С версии 10.9.0 Введена.

Код ProductStockStatus::get_all() WC 11.2.2

public static function get_all(): array {
	return array(
		self::IN_STOCK,
		self::OUT_OF_STOCK,
		self::ON_BACKORDER,
		self::LOW_STOCK,
	);
}