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.

Method of the class: ProductStockStatus{}

No Hooks.

Returns

string[].

Usage

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

Changelog

Since 10.9.0 Introduced.

ProductStockStatus::get_all() code WC 11.3.0

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