Open
Description
Describe the bug
Discount assigned to role doesn't work if you do not have a general discount on the product (no role).
To Reproduce
Steps to reproduce the behavior:
- Create product without discount in woocommerce.
- Assign regular price and sale price to a role.
- The user with that role will get the discounted price, but will not receive the crossed out price indicating that it is on sale.
Expected behavior
They should appear in the format wc_format_sale_price()
Additional context
The problem seems to be in the WooCommerce_Role_Based_Price_Product_Pricing->get_price_html_wc3();
$product->is_on_sale() returns false because for wordpress that product is not on sale.
...
} else if( $product->is_on_sale() && $prices['min_reg_price'] === $prices['max_reg_price'] ) {
$price = wc_format_sale_price(wc_price($prices['max_reg_price']), wc_price($prices['min_price']));
} else {
....
A possible fix could be add filter on the woocommerce_product_is_on_sale
hook and modify this value for products that they have different regular and sale price or perhaps put one more condition in that same function.
Regards
Metadata
Metadata
Assignees
Labels
No labels