Commit ce330921f12 for woocommerce
commit ce330921f12429b012fbc7c871ba82ec0906089a
Author: Wesley Rosa <wesleyjrosa@gmail.com>
Date: Mon Aug 24 17:27:34 2026 -0300
Use enum constants in developer docs code examples (#67982)
diff --git a/docs/features/orders/high-performance-order-storage/wc-order-query-improvements.md b/docs/features/orders/high-performance-order-storage/wc-order-query-improvements.md
index 5e198f00818..1a2d042c9b0 100644
--- a/docs/features/orders/high-performance-order-storage/wc-order-query-improvements.md
+++ b/docs/features/orders/high-performance-order-storage/wc-order-query-improvements.md
@@ -128,7 +128,7 @@ $orders = wc_get_orders(
// Obtain orders either "on-hold" or "pending" that have metadata `weight` >= 50 and metadata `color` or `size` is set.
$query_args = array(
- 'status' => array( 'pending', 'on-hold' ),
+ 'status' => array( \Automattic\WooCommerce\Enums\OrderStatus::PENDING, \Automattic\WooCommerce\Enums\OrderStatus::ON_HOLD ),
'meta_query' => array(
array(
'key' => 'weight',
diff --git a/docs/features/orders/wc-get-orders.md b/docs/features/orders/wc-get-orders.md
index 7ae664dd5cd..9dfed7fa19e 100644
--- a/docs/features/orders/wc-get-orders.md
+++ b/docs/features/orders/wc-get-orders.md
@@ -75,7 +75,7 @@ Query parameters/arguments that can be used with these functions are described b
| Parameter | Description |
| --- | --- |
-| **status** | Accepts an array of strings: by default is set to the keys of `wc_get_order_statuses()`. |
+| **status** | Accepts an array of strings: by default is set to the keys of `wc_get_order_statuses()`. Both `wc-`-prefixed (`'wc-processing'`) and unprefixed (`'processing'`) values are accepted. See the [OrderInternalStatus](https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/src/Enums/OrderInternalStatus.php) and [OrderStatus](https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/src/Enums/OrderStatus.php) constant classes. |
| **type** | Accepts a string: `'shop_order'`, `'shop_order_refund'`, or a custom order type. |
| **version** | Accepts a string: WooCommerce version number the order was created in. |
| **created_via** | Accepts a string: 'checkout', 'rest-api', or a custom creation method slug. |
@@ -115,6 +115,17 @@ $args = array(
$orders = wc_get_orders( $args );
```
+```php
+// Using constant classes for status.
+$args = array(
+ 'status' => array(
+ \Automattic\WooCommerce\Enums\OrderInternalStatus::PROCESSING,
+ \Automattic\WooCommerce\Enums\OrderInternalStatus::ON_HOLD,
+ ),
+);
+$orders = wc_get_orders( $args );
+```
+
```php
// Get refunds in the last 24 hours.
$args = array(
diff --git a/docs/features/payments/payment-gateway-api.md b/docs/features/payments/payment-gateway-api.md
index 393388b94ba..b7a6184eff8 100644
--- a/docs/features/payments/payment-gateway-api.md
+++ b/docs/features/payments/payment-gateway-api.md
@@ -158,7 +158,7 @@ global $woocommerce;
$order = new WC_Order( $order_id );
// Mark as on-hold (we're awaiting the cheque)
- $order->update_status('on-hold', __( 'Awaiting cheque payment', 'woocommerce' ));
+ $order->update_status(\Automattic\WooCommerce\Enums\OrderStatus::ON_HOLD, __( 'Awaiting cheque payment', 'woocommerce' ));
// Remove cart
$woocommerce->cart->empty_cart();
@@ -204,7 +204,7 @@ Updating the order status can be done using functions in the order class. You sh
```php
$order = new WC_Order( $order_id );
-$order->update_status('on-hold', __('Awaiting cheque payment', 'woothemes'));
+$order->update_status(\Automattic\WooCommerce\Enums\OrderStatus::ON_HOLD, __('Awaiting cheque payment', 'woothemes'));
```
The above example updates the status to On-Hold and adds a note informing the owner that it is awaiting a Cheque. You can add notes without updating the order status; this is used for adding a debug message:
diff --git a/docs/features/products/wc-get-products.md b/docs/features/products/wc-get-products.md
index bd15ae39f12..768d01476ca 100644
--- a/docs/features/products/wc-get-products.md
+++ b/docs/features/products/wc-get-products.md
@@ -88,6 +88,11 @@ $products = wc_get_products( array( 'status' => \Automattic\WooCommerce\Enums\Pr
$products = wc_get_products( array( 'type' => 'external' ) );
```
+```php
+// Using constant class for type.
+$products = wc_get_products( array( 'type' => \Automattic\WooCommerce\Enums\ProductType::EXTERNAL ) );
+```
+
```php
// Get external products limited to specific IDs.
$args = array(