• Resolved mathieupreaud

    (@mathieupreaud)


    Hi,

    I set up my tax configuration to show prices excluding tax in Cart and Checkout. However I noticed that the prices displayed in the Minicart widget also exclude tax.

    Is it possible to display the prices in the Minicart with tax included as displayed on my product page and keep the prices in Cart and Checkout pages without tax?

    Here is the line of code to display the product price in minicart.php

    $product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );

    Any help would be much appreciated!

    Thank you.

    • This topic was modified 3 years, 10 months ago by mathieupreaud.
    • This topic was modified 3 years, 10 months ago by mathieupreaud.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello @mathieupreaud ,

    I understand your request.

    You have landed on the correct filter as well. You will have to get the price usign this function – wc_get_price_including_tax()

    You will find some example of modifying price display in the cart here – https://www.skyverge.com/blog/change-woocommerce-price-display/

    I hope this information helps.

    Thank you ??

    Thread Starter mathieupreaud

    (@mathieupreaud)

    Hello @rur165,

    Thank you for your reply and for the link. I read the article but I’m not sure how I can apply it to display the prices with tax in the Minicart.

    Regarding wc_get_price_including_tax() I tried to use it I don’t success to make it work inside the filter:

    $product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );

    Thanks again!

    Thread Starter mathieupreaud

    (@mathieupreaud)

    In mini-cart.php I change the filter:

    $product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );

    For:

    $product_price = apply_filters( 'woocommerce_cart_item_price', wc_get_price_including_tax( $_product ), $cart_item, $cart_item_key );

    However I’m not sure if it’s correct. Is it the right way to do it?

    Using that solution I have a few issues:

    – The price in the Mini Cart now includes tax. But for example the price is displayed 290.5, it should be 290.50$. How can I keep the two decimals and the currency symbol?

    – Last question, how can I display the subtotal with tax included? Right now the subtotal is tax excluded.

    Thank you.

    • This reply was modified 3 years, 10 months ago by mathieupreaud.
    • This reply was modified 3 years, 10 months ago by mathieupreaud.

    Hi there,

    This is a fairly complex development topic that I can cover within this forum. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    If you need a paid solution, you can consider taking help from one of our partner’s website.

    Thank you ??

    Thread Starter mathieupreaud

    (@mathieupreaud)

    I hope someone could help on that topic.

    Thank you @rur165

    • This reply was modified 3 years, 10 months ago by mathieupreaud.

    Hello @mathieupreaud ,

    It looks like we will not get any more help on this topic. I am going to close this thread. I hope you can take suggestion from the resource shared above and get your desired result.

    In case you did not get the solution yet, consider taking help from a freelance Woo expert or check the offers from our partner’s site.

    Thank you ??

    Thread Starter mathieupreaud

    (@mathieupreaud)

    Hello @rur165,

    Thank you for your help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Show prices with tax in Minicart widget’ is closed to new replies.