Automattic\WooCommerce\Admin\API
Coupons::get_items
Get a collection of posts and add the code search option to WP_Query.
Method of the class: Coupons{}
No Hooks.
Returns
WP_Error|WP_REST_Response.
Usage
$Coupons = new Coupons(); $Coupons->get_items( $request );
- $request(WP_REST_Request) (required)
- Full details about the request.
Coupons::get_items() Coupons::get items code WC 10.8.1
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;
}