OrderStatus
in package
Enum class for all the order statuses.
For a full documentation on the public order statuses, please refer to the following link: https://woocommerce.com/document/managing-orders/order-statuses/
Table of Contents
- AUTO_DRAFT = 'auto-draft'
- The order is an automatically generated draft.
- CANCELLED = 'cancelled'
- The order was canceled by an admin or the customer.
- CHECKOUT_DRAFT = 'checkout-draft'
- Checkout Draft orders are created when customers start the checkout process while the block version of the checkout is in place.
- COMPLETED = 'completed'
- Order fulfilled and complete.
- DRAFT = 'draft'
- Draft orders are created when customers start the checkout process while the block version of the checkout is in place.
- FAILED = 'failed'
- The customer’s payment failed or was declined, and no payment has been successfully made.
- NEW = 'new'
- The order is a draft (legacy status).
- ON_HOLD = 'on-hold'
- The order is awaiting payment confirmation.
- PAYMENT_COMPLETE_STATUSES = array(self::ON_HOLD, self::PENDING, self::FAILED, self::CANCELLED)
- Array of all the valid order statuses for a complete payment.
- PENDING = 'pending'
- The order has been received, but no payment has been made.
- PROCESSING = 'processing'
- Payment has been received (paid), and the stock has been reduced.
- REFUNDED = 'refunded'
- Orders are automatically put in the Refunded status when an admin or shop manager has fully refunded the order’s value after payment.
- TRASH = 'trash'
- The order is in the trash.
- get_all() : array<string|int, string>
- Returns every order status value defined by this enum, as a flat list of unprefixed slugs.
Constants
AUTO_DRAFT
The order is an automatically generated draft.
public
string
AUTO_DRAFT
= 'auto-draft'
CANCELLED
The order was canceled by an admin or the customer.
public
string
CANCELLED
= 'cancelled'
CHECKOUT_DRAFT
Checkout Draft orders are created when customers start the checkout process while the block version of the checkout is in place.
public
string
CHECKOUT_DRAFT
= 'checkout-draft'
COMPLETED
Order fulfilled and complete.
public
string
COMPLETED
= 'completed'
DRAFT
Draft orders are created when customers start the checkout process while the block version of the checkout is in place.
public
string
DRAFT
= 'draft'
FAILED
The customer’s payment failed or was declined, and no payment has been successfully made.
public
string
FAILED
= 'failed'
NEW
The order is a draft (legacy status).
public
string
NEW
= 'new'
ON_HOLD
The order is awaiting payment confirmation.
public
string
ON_HOLD
= 'on-hold'
PAYMENT_COMPLETE_STATUSES
Array of all the valid order statuses for a complete payment.
public
array<string|int, string>
PAYMENT_COMPLETE_STATUSES
= array(self::ON_HOLD, self::PENDING, self::FAILED, self::CANCELLED)
PENDING
The order has been received, but no payment has been made.
public
string
PENDING
= 'pending'
PROCESSING
Payment has been received (paid), and the stock has been reduced.
public
string
PROCESSING
= 'processing'
REFUNDED
Orders are automatically put in the Refunded status when an admin or shop manager has fully refunded the order’s value after payment.
public
string
REFUNDED
= 'refunded'
TRASH
The order is in the trash.
public
string
TRASH
= 'trash'
Methods
get_all()
Returns every order status value defined by this enum, as a flat list of unprefixed slugs.
public
static get_all() : array<string|int, string>
It differs from the statuses WooCommerce registers in both directions. It carries self::TRASH, self::NEW, self::AUTO_DRAFT and self::DRAFT, which wc_get_order_statuses() does not return by default, and it cannot carry statuses an extension registers. WC_Abstract_Order::set_status() accepts self::TRASH and self::AUTO_DRAFT even so, exempting them from its own validation.
self::CHECKOUT_DRAFT sits on the helper's side of that line: WooCommerce adds it through the
wc_order_statuses filter, and the Store API assigns it to live orders during checkout.
For the registered statuses, use wc_get_order_statuses(). It returns a value => label map
keyed on the wc- prefixed slug, so comparing its keys with this enum's values needs
OrderUtil::remove_status_prefix(). OrderInternalStatus lists the seven core statuses in
prefixed form.
