WC_REST_Orders_V1_Controller::get_collection_params()publicWC 1.0

Get the query params for collections.

Method of the class: WC_REST_Orders_V1_Controller{}

No Hooks.

Return

Array.

Usage

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

WC_REST_Orders_V1_Controller::get_collection_params() code WC 8.7.0

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' ), $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',
	);

	return $params;
}