Hi, usually strikethrough on a price means that that’s the regular price, but the product has a sale price applied. However that should appear together with the actual sale price and only in the product page, not in the cart.
Also since you say that you deactivated all the plugins in your site I assume that you don’t have any custom code snippet in place either, is that correct?
Could you please open an bug report in GitHub? Please provide details about how your store is configured and to the extent possible, detailed reproduction steps (which would likely include creating products configured as the ones in your store). You can then answer here with a link to the created issue. Thank you!
Hello there,
Thank you for drawing our attention to any custom coding. We found the culprit causing the issue to be this snippet in our functions.php:
/* Show sale & regular price on the checkout page */
add_filter("woocommerce_cart_item_subtotal", "al_display_discount_price", 10, 3);
function al_display_discount_price($product_price, $cart_item, $cart_item_key)
{
$regular_price = wc_price( $cart_item['data']->get_regular_price() );
if( $product_price != $regular_price )
{
if(isset( $cart_item['cartflows_bump'] ) && 1 == $cart_item['cartflows_bump'])
{
$product_price = wc_format_sale_price( $cart_item['data']->get_regular_price(), $cart_item['custom_price'] );
}else{
$product_price = wc_format_sale_price( $cart_item['data']->get_regular_price(), $cart_item['data']->get_sale_price() );
}
}
return $product_price;
}
Upon removing this snippet, the issue is fixed. However, the functionality where it displays the regular price AND sales price on the checkout page is gone.
How can we modify this snippet so it won't create any issues, but still displays the sales and regular price?
Any help is much appreciated.
I have tested your snippet as-is in a test site and it works as expected, showing something like $10.00 $5.00 in the cart page.
If either the regular price or the sale price passed to wc_format_sale_price aren’t valid numbers they won’t be displayed, but I can’t figure out what could cause $cart_item['data']->get_regular_price() to return a wrong number. Do you have any other snippet hooking on woocommerce_format_sale_price by chance?
Edit: for the line that shows only the strike-through’ed price, what is returning a wrong number is either $cart_item['data']->get_sale_price() or $cart_item['custom_price'], depending on the result of the if. Where does that 'custom_price' key come from? Are you sure that it always has a valid value?