• 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)
  • woocommerce_rest_product_object_query
    filter should do the trick

    • This reply was modified 8 years, 7 months ago by rumo777.
    • This reply was modified 8 years, 7 months ago by rumo777.
Viewing 1 replies (of 1 total)

The topic ‘[REST API] woocommerce_rest_product_query’ is closed to new replies.