Automattic\WooCommerce\Admin\API

Coupons::prepare_objects_query()protectedWC 1.0

Add coupon code searching to the WC API.

Method of the class: Coupons{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_objects_query( $request );
$request(WP_REST_Request) (required)
Request data.

Coupons::prepare_objects_query() code WC 9.3.3

protected function prepare_objects_query( $request ) {
	$args = parent::prepare_objects_query( $request );

	if ( ! empty( $request['search'] ) ) {
		$args['search'] = $request['search'];
		$args['s']      = false;
	}

	return $args;
}