WooCommerce Code Reference

ProductStatus
in package

Enum class for all the product statuses.

Table of Contents

AUTO_DRAFT  = 'auto-draft'
The product is in auto-draft status.
DRAFT  = 'draft'
The product is in draft status.
FUTURE  = 'future'
The product is in future status.
PENDING  = 'pending'
The product is in pending status.
PRIVATE  = 'private'
The product is in private status.
PUBLISH  = 'publish'
The product is in publish status.
TRASH  = 'trash'
The product is in trash status.
get_all()  : array<string|int, string>
Returns every product status value defined by this enum, as a flat list.

Constants

Methods

get_all()

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

public static get_all() : array<string|int, string>

A product can hold any of them: WC_Product::set_status() does not validate, and core assigns self::AUTO_DRAFT and self::TRASH itself. What separates them is who decides. WordPress sets self::AUTO_DRAFT, self::TRASH and self::FUTURE; an author chooses the rest.

WooCommerce has no narrower helper, and get_post_statuses() is not one: it is unfiltered and lists only draft, pending, private and publish. Narrow this list yourself for a particular editor or REST schema.

Tags
since
10.9.0
Return values
array<string|int, string> —