Automattic\WooCommerce\Admin\API

Coupons::get_items()publicWC 1.0

Get a collection of posts and add the code search option to WP_Query.

Метод класса: Coupons{}

Хуков нет.

Возвращает

WP_Error|WP_REST_Response.

Использование

$Coupons = new Coupons();
$Coupons->get_items( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код Coupons::get_items() WC 8.7.0

public function get_items( $request ) {
	add_filter( 'posts_where', array( __CLASS__, 'add_wp_query_search_code_filter' ), 10, 2 );
	$response = parent::get_items( $request );
	remove_filter( 'posts_where', array( __CLASS__, 'add_wp_query_search_code_filter' ), 10 );
	return $response;
}