79121027

Date: 2024-10-24 08:36:17
Score: 0.5
Natty:
Report link

copy this and paste it in your function.php file. wp-json/wc/v3/orders?your_query_param=your-search-value

add_filter('woocommerce_rest_shop_order_object_query', 'wc_enable_custom_filters', 10, 2);

function wc_enable_custom_filters($args, $request) {

    // Filter by church ID
    $your_query_param = $request->get_param('your_query_param');
    if ($your_query_param) {
        $args['meta_query'][] = array(
            'key'     => 'your_query_param', // Change this to your actual meta key
            'value'   => $your_query_param,
            'compare' => '='
        );
    }

    return $args;
}
                           
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Admond Tamang