[REST API] woocommerce_rest_product_query
-
I’m trying to use the filter woocommerce_rest_product_query, but does not seem to work for the endpoint /wp-json/wc/v2/products
rest_product_query, works for /wp-json/wp/v2/product, but not for woocommerce_rest_product_query
Here a exemple of code:
function filter_rest_post_query( $args, $request ) { $lng = $request->get_param('lng'); if ( ! empty( $lng ) ) { $args['meta_query'] = array( array( 'key' => 'lng', 'value' => $lng, 'compare' => '=', ), ); } return $args; } add_filter( 'woocommerce_rest_product_query', 'filter_rest_post_query', 10, 2 );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘[REST API] woocommerce_rest_product_query’ is closed to new replies.