This is my WordPress configuration (Just upgraded everything, so everything is up to date):<br>
WordPress: 5.4<br>
WooCommerce: 4.0.1<br>
<a href="https://wordpress.org/plugins/woo-discount-rules/" rel="nofollow noreferrer">Discount Rules for WooCommerce</a>: 1.9.7
Discount Rules for WooCommerce configuration, per quantity block:<br>
1-4 : 10%<br>
5-24: 20%<br>
25-99999: 30%
This is working perfectly fine on the shop and shop can even get orders properly with discounts.
The thing is that I want to remove SALE! badge from the products as it is automatically added because of 1-4 quantity block which means default 10% site-wide discount as per the configuration.
Now, here is my code in theme's functions.php
<strong>Problem</strong>: No matter what I try, I always get
result always 0. And, the strange thing is that
result is
.
Because of this I cannot find out the product discount and so cannot remove SALE label for the 1-4 quantity block.
WordPress: 5.4<br>
WooCommerce: 4.0.1<br>
<a href="https://wordpress.org/plugins/woo-discount-rules/" rel="nofollow noreferrer">Discount Rules for WooCommerce</a>: 1.9.7
Discount Rules for WooCommerce configuration, per quantity block:<br>
1-4 : 10%<br>
5-24: 20%<br>
25-99999: 30%
This is working perfectly fine on the shop and shop can even get orders properly with discounts.
The thing is that I want to remove SALE! badge from the products as it is automatically added because of 1-4 quantity block which means default 10% site-wide discount as per the configuration.
Now, here is my code in theme's functions.php
Code:
function wc_custom_replace_sale_text($html, $post, $product) {
if ($product->is_on_sale()) {
$regular_price = $product->get_regular_price();
$sale_price = $product->get_sale_price();
return '<span class="onsale force-display">' . $sale_price . '</span>';
}
}
add_filter( 'woocommerce_sale_flash', 'wc_custom_replace_sale_text', 10, 3 );
<strong>Problem</strong>: No matter what I try, I always get
Code:
$product->get_sale_price()
Code:
$product_is_on_sale()
Code:
true
Because of this I cannot find out the product discount and so cannot remove SALE label for the 1-4 quantity block.