Custom query for ‘active lottery’ only woocommerce lottery plugin and element

I want to create a custom query that returns only the active lottery products on my lottery ‘style’ website. I have been given a query but I am not sure where to put this query in my website, wordpress directory etc.

I want the query to be used in a specific post widget using the Elementor Post widget.

Here is the code that I have been told will revert to active lottery products.

// Return active lottery products.
$args = array(
    'fields' => 'ids',
    'post_type'=> 'product',
    'show_past_lottery' => FALSE,   
    'tax_query' => array(array('taxonomy' => 'product_type' , 'field' => 'slug', 'terms' => 'lottery')),    
);  

Can anyone tell me if I am missing anything to get this to work.

I am using wp-genie woocommerce lottery plugin. If you need some more information here is the documentation page. https://wpgenie.org/woocommerce-lottery/documentation/

Leave a Comment