Dates and status in Query builder

Hi there,
I want to filter the Woocommerce products via the query builder.
I created an ACF field name 'event_date" for products (date and time of event).
The filter I want must display the products with:

  • status = “Publish”
  • ACF(event_date) >= today (date and time)

I was looking for the status in the different options: I found nothing
I was looking for how to check the date, nothing else.

Can you help me, please.
PS: I can do it via a shortcode but I think that the query builder was made for, at least for the status

Here are the shortcodes:

add_shortcode( 'expired-date', function (){
	global $post;
	date_default_timezone_set("Europe/Paris");
	$tod = date('Y-m-d H:i:s');
	date_default_timezone_set("UTC");
	$eve = date('Y-m-d H:i:s', strtotime(str_replace('/', '-', get_field( 'event_date', $post->ID ))));
	$ret = ( $tod >= $eve );
	return "$ret";
});

add_shortcode( 'is_publish', function (){
	global $post;
	$ret = ( get_post_status ( $ID ) == 'publish' );
	return "$ret";
});
1 Like