I’d like to modify pre_get_posts so that I can show sale items if ?sale=1 is present in the URL.
I found the following code from another site, and this works well:
$meta_query = array( array( 'key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ) );
However this returns products who are *scheduled* to go on sale. How do I check to ensure I don’t include those products that aren’t also scheduled to go on sale in the future.
- The topic ‘Show sale items in query’ is closed to new replies.