Discount not applying in custom WP_Query
-
Hello!
I have a problem where discounts are not applied to prices in custom WP_Queries outside of woocommerce.php. For example, it doesn’t work on the front page.
add_filter( 'woocommerce_format_sale_price', 'wlsn_woocommerce_format_sale_price', 10, 21 ); function wlsn_woocommerce_format_sale_price( $price, $regular_price, $sale_price ) {}
In this filter the $sale_price comes back empty inside of a custom loop, inside of the archive loop $sale_price returns the discounted price from your plugin.
I’m using the exact same code for my product in archives and custom loops.
Any idea why this happens?
- The topic ‘Discount not applying in custom WP_Query’ is closed to new replies.