I'm using WooCommerce and I'm trying to filter my products by price. My problem is that the
meta_key is only taking into account the regular price and not the sale price.
As a result if a product is on sale, the sale price is ignored by my filter and all of the products are ordered by the regular price.
Is there a way I can order my products by both the regular price and the sale price? Any help will be greatly appreciated!
$args = array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'taxonomy' => 'product_cat', 's' => $search_term, 'orderby' => 'meta_value_num', 'order' => 'DESC', 'meta_key' => '_price', );