woocommerce sale badge displayed for all product variation with same price

when using a product variation with the same regular&sale price, the sticky label is displayed when it shouldn’t.

http://www.emr-guardian.com/solutions/clothing-accessories/belly-band/

Read More

In fact, as you can see to the link above, I have a product with two colors variation and for each, the same regular/sale price.

Is clearly not a promotion in this case but label is displayed the same (!?)

This works nicely with single products:

same regular/sale price => sticky label off

different regular/sale price => sticky label on

So, I would like to achieve the same as for single product and have the same behavior when almost one of the variation have different regular/sale prices.

I noticed the following in woocommerce/includes/abstracts/abstract-wc-product.php:

public function is_on_sale() {
return ( $this->get_sale_price() != $this->get_regular_price() && $this-   >get_sale_price() == $this->get_price() );   
}

The check seem to me made ONLY for single product price but not for variation one for whcih we may need to instantiate the appropriate class.

LS

Related posts

Leave a Reply