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.
So in mini-cart.php I modified the following filter:
$ product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $ _product ), $ cart_item, $ cart_item_key );
$ product_price = apply_filters( 'woocommerce_cart_item_price', wc_get_price_including_tax( $ _product ), $ cart_item, $ cart_item_key );
In the filter I use
wc_get_price_including_tax() to display the product price with tax.
The price in the Mini Cart now includes tax. However I’m not sure if it’s correct. What is the right way to do it?
Using that solution I have a few issues:
– For example the price is displayed
290.5, it should be
290.50$ . How can I keep the two decimals and the currency symbol? (In the Woocommerce configuration the decimals are set to "2").
– Last question, how can I display the subtotal with tax included? Right now the subtotal is tax excluded.
Any help would be much appreciated, thank you!