WooCommerce Code Reference

Search results

WC_Order_Query extends WC_Object_Query

Order query class.

Extended by classes to provide a query abstraction layer for safe object searching.

Table of Contents

$query_vars Stores query data. array
get_default_query_vars() Valid query vars for orders. array
get_orders() Get orders matching the current query vars. array|object
__construct() Create a new query. mixed
get_query_vars() Get the current query vars. array
get() Get the value of a query variable. mixed
set() Set a query variable. mixed
get_default_query_vars() Get the default allowed query vars. array

Properties

Methods

get_default_query_vars()

Valid query vars for orders.

protected get_default_query_vars( ) : array
Return values
array

get_orders()

Get orders matching the current query vars.

public get_orders( ) : array|object
Tags
throws

When WC_Data_Store validation fails.

Return values
array|object

of WC_Order objects

__construct()

Create a new query.

public __construct( [ $args : array = array() ] ) : mixed
Parameters
$args : array = array()

Criteria to query on in a format similar to WP_Query.

Return values
mixed

get()

Get the value of a query variable.

public get( $query_var : string [, $default : mixed = '' ] ) : mixed
Parameters
$query_var : string

Query variable to get value for.

$default : mixed = ''

Default value if query variable is not set.

Return values
mixed

Query variable value if set, otherwise default.

set()

Set a query variable.

public set( $query_var : string , $value : mixed ) : mixed
Parameters
$query_var : string

Query variable to set.

$value : mixed

Value to set for query variable.

Return values
mixed

get_default_query_vars()

Get the default allowed query vars.

protected get_default_query_vars( ) : array
Return values
array
Back to the top