Hi Minesh,
Unfortunately, I am not authorized to give administrative access to this site, as it contains sensitive customer data.
I hope you can help me anyway.
The code I sent you earlier is a shortened version of the one we have in place.
You are correctly assuming that we need to filter the posts with post status equal to completed and meta key ticket exchange equal to refund, but we could achieve that also using the View interface.
The reason we use an external query is that we need to search multiple fields using only one parameter.
add_filter( 'wpv_filter_query', 'show_all_refunds', 101, 3 );
function show_all_refunds( $query_args, $view_settings, $view_id ) {
if ($view_id == 80055) {
$csearch = $_GET["csearch"];
$query_args = array(
'post_type' => 'shop_order',
'posts_per_page' => 20,
'post_status' => 'wc-completed',
'meta_key' => 'wpcf-ticket-exchange-request-date',
'orderby' => 'meta_value',
'order' => 'DESC',
'meta_query' =>
array(
'relation' => 'AND',
array(
'key' => 'wpcf-tickets-exchange',
'value' => 'Refund',
),
array(
'relation' => 'OR',
array(
'key' => '_billing_first_name',
'value' => $csearch,
'compare' => 'LIKE',
),
array(
'key' => '_billing_last_name',
'value' => $csearch,
'compare' => 'LIKE',
),
array(
'key' => '_billing_email',
'value' => $csearch,
'compare' => 'LIKE',
),
)
);
}
return $query_args;
}
Everything works, we just can't paginate the results.
Thanks for your support.