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
AUTO_DRAFT
The product is in auto-draft status.
public
string
AUTO_DRAFT
= 'auto-draft'
DRAFT
The product is in draft status.
public
string
DRAFT
= 'draft'
FUTURE
The product is in future status.
public
string
FUTURE
= 'future'
PENDING
The product is in pending status.
public
string
PENDING
= 'pending'
PRIVATE
The product is in private status.
public
string
PRIVATE
= 'private'
PUBLISH
The product is in publish status.
public
string
PUBLISH
= 'publish'
TRASH
The product is in trash status.
public
string
TRASH
= 'trash'
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.
