Home Forums WoodMart support forum Make discounted price appear in Cart and Checkout Page

Make discounted price appear in Cart and Checkout Page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #668491

    o.elarbi
    Participant

    Hello,

    I want the original price and the discounted price to show up in cart page, cart side menu, and checkout page please. How to do it please?

    Please see attached screenshot. Those products inside the red squares are discounted products, but I need to show the original price before the discount (with a line crossing through it).

    Thanks,
    Omar

    • This topic was modified 2 months, 4 weeks ago by o.elarbi.
    • This topic was modified 2 months, 4 weeks ago by o.elarbi.
    Attachments:
    You must be logged in to view attached files.
    #668569

    Hello,

    Sorry to say there are no options in theme settings available for that. This requires customization, which is beyond our support policy.

    I have searched for a possible solution and found a custom function that you can add to your functions.php file. I have tested this code on our test site, and it is working fine.

    If the provided code does not work as expected, unfortunately, we are unable to modify it further.
    Add this to your theme’s functions.php file of the theme.

    add_filter('woocommerce_cart_item_price', 'pk_cart_price_display', 10, 3);
    function pk_cart_price_display($price_html, $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());
            $price_html = '<del>' . $regular_price . '</del> <ins>' . $sale_price . '</ins>';
        }
    
        return $price_html;
    }
    
    // Show sale and regular price in mini cart
    add_filter('woocommerce_cart_item_subtotal', 'pk_cart_price_display', 10, 3);

    Hope this Helps!

    Best Regards,

    #669458

    o.elarbi
    Participant

    Hi Aizaz,

    Thank you for the support.

    The code you gave me worked on both the cart and the checkout page, but not on the mini cart (side menu cart). I’d really appreciate it if you could help us add it to the side menu as well.

    Thanks
    Omar

    #669515

    Hello,

    Sorry, but there is no option in Theme Settings available for that.

    It requires customizations, and this is beyond our limitations and support policy.

    Best Regards,

Viewing 4 posts - 1 through 4 (of 4 total)