WC_REST_Orders_V2_Controller::get_collection_params()publicWC 1.0

Get the query params for collections.

Method of the class: WC_REST_Orders_V2_Controller{}

No Hooks.

Return

Array.

Usage

$WC_REST_Orders_V2_Controller = new WC_REST_Orders_V2_Controller();
$WC_REST_Orders_V2_Controller->get_collection_params();

WC_REST_Orders_V2_Controller::get_collection_params() code WC 8.6.1

public function get_collection_params() {
	$params = parent::get_collection_params();

	$params['status']                  = array(
		'default'           => 'any',
		'description'       => __( 'Limit result set to orders assigned a specific status.', 'woocommerce' ),
		'type'              => 'string',
		'enum'              => array_merge( array( 'any', 'trash' ), $this->get_order_statuses() ),
		'sanitize_callback' => 'sanitize_key',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['customer']                = array(
		'description'       => __( 'Limit result set to orders assigned a specific customer.', 'woocommerce' ),
		'type'              => 'integer',
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['product']                 = array(
		'description'       => __( 'Limit result set to orders assigned a specific product.', 'woocommerce' ),
		'type'              => 'integer',
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['dp']                      = array(
		'default'           => wc_get_price_decimals(),
		'description'       => __( 'Number of decimal points to use in each resource.', 'woocommerce' ),
		'type'              => 'integer',
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['order_item_display_meta'] = array(
		'default'           => false,
		'description'       => __( 'Only show meta which is meant to be displayed for an order.', 'woocommerce' ),
		'type'              => 'boolean',
		'sanitize_callback' => 'rest_sanitize_boolean',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['include_meta']            = array(
		'default'           => array(),
		'description'       => __( 'Limit meta_data to specific keys.', 'woocommerce' ),
		'type'              => 'array',
		'items'             => array(
			'type' => 'string',
		),
		'sanitize_callback' => 'wp_parse_list',
	);
	$params['exclude_meta']            = array(
		'default'           => array(),
		'description'       => __( 'Ensure meta_data excludes specific keys.', 'woocommerce' ),
		'type'              => 'array',
		'items'             => array(
			'type' => 'string',
		),
		'sanitize_callback' => 'wp_parse_list',
	);

	return $params;
}