A user reported that broadcasting a Woocommerce product, that is supposed to be shown in a query loop element, did not show the product.
The solution was some custom code instead of the query element.
add_action('elementor/query/sale_products_active', function($query) {
$current_time = current_time('timestamp');
$meta_query = [
'relation' => 'OR',
[
'key' => '_sale_price',
'value' => 0,
'compare' => '>',
'type' => 'NUMERIC',
],
[
'key' => '_min_variation_sale_price',
'value' => 0,
'compare' => '>',
'type' => 'NUMERIC',
]
];
$date_query = [
'relation' => 'OR',
[
'key' => '_sale_price_dates_to',
'value' => '',
'compare' => 'NOT EXISTS'
],
[
'key' => '_sale_price_dates_to',
'value' => $current_time,
'compare' => '>=',
'type' => 'NUMERIC'
]
];
$query->set(‘meta_query’, [
‘relation’ => ‘AND’,
$meta_query,
$date_query
]);
});