Show Regular & Sale Prices in WooCommerce Cart

Code Snippets Coding Blog Custom Code Snippets Debugging PHP PHP Development Plugins Tech Tutorials Theme Optimization Tutorials Woocommerce WooCommerce Customization WooCommerce Development Woocommerce Hooks WooCommerce Tips Wordpress WordPress Development WordPress Hacks WordPress Tips WP Best Practices

Show Regular & Sale Prices in WooCommerce Cart Tutorial/Guide

Want to show both the original (regular) and discounted (sale) prices in the WooCommerce cart? Use the woocommerce_cart_item_price filter to do this easily. Step 1: Go to your theme’s functions.php file. Step 2: Paste this code into the file:

// Show regular and sale prices in cart table
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);

Step 3: Save and upload the updated file. Now, your cart table will display the regular price as a strikethrough and the sale price as highlighted. This visual cue helps customers clearly see the savings. If you're using a custom cart template, some CSS or template adjustments may be needed.  

💡 Have a Coding Problem?

Search our archives or reach out to our team for solutions and expert advice.