How to combine search post-type for EventChamp ‘event’ and woocommerce ‘product’?

I’m trying to combine the search for event and product. But i unable to get the result by price.

$arg = array(
‘post_status’ => ‘publish’,
‘ignore_sticky_posts’ => true,
‘post_type’ => array(‘event’, ‘product’),
);

$extra_query = array(
‘meta_query’ => array(
‘relation’ => ‘AND’,
array(
array(
‘key’ => ‘event_start_date’,
‘compare’ => $search_startdate_compare,
‘value’ => $search_startdate,
),
array(
‘key’ => ‘event_end_date’,
‘compare’ => $search_enddate_compare,
‘value’ => $search_enddate,
),
‘relation’ => ‘AND’
),

array(
‘key’ => ‘event_remaining_tickets’,
‘compare’ => ‘EXISTS’,
),
array(
array(
‘key’ => ‘_price’,
‘value’ => $search_price,
‘compare’ => $search_price_compare,
‘type’ => ‘NUMERIC’,
),
array(
‘key’ => ‘_regular_price’,
‘value’ => $search_price,
‘compare’ => $search_price_compare,
‘type’ => ‘NUMERIC’,
),
array(
‘key’ => ‘_sale_price’,
‘value’ => $search_price,
‘compare’ => $search_price_compare,
‘type’ => ‘NUMERIC’,
),
‘relation’ => ‘OR’
),

),
);
$arg = wp_parse_args( $arg, $extra_query );

Read more here:: How to combine search post-type for EventChamp ‘event’ and woocommerce ‘product’?

Leave a Reply

Your email address will not be published. Required fields are marked *