Display Both Sale & Regular Prices in WooCommerce Cart

To help customers understand how much they’re saving, you can show both the sale price and the regular price right in the WooCommerce cart. Here’s how to implement this using a filter.

Step 1: Open the functions.php file of your current theme.

Step 2: Add this PHP code snippet:

// Display regular and sale price in cart
function modify_cart_item_price($product_price, $cart_item, $cart_item_key) {
    $product = $cart_item['data'];

    if ($product->is_on_sale()) {
        $regular_price = wc_price($product->get_regular_price());
        $sale_price = wc_price($product->get_price());

        $product_price = '<del>' . $regular_price . '</del> <ins>' . $sale_price . '</ins>';
    }

    return $product_price;
}
add_filter('woocommerce_cart_item_price', 'modify_cart_item_price', 10, 3);

Once added, WooCommerce will render a crossed-out original price followed by the sale price for every discounted item in the cart.

This helps improve user experience by visually emphasizing discounts. Make sure it blends well with your theme’s design, especially if using a custom cart layout.

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.