Shows items in excluding tax cart – with price including tax
-
Hi All,
I have a cart setting to display prices excluding tax. But i need the items within the cart to be displayed including tax. (Only the items!)
in cart.php I found this for item price:
<td class="product-price" data-title="<?php _e( 'Price', 'woocommerce' ); ?>"> <?php echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); ?> </td>
And this for cart item subtotal:
<td class="product-subtotal" data-title="<?php _e( 'Total', 'woocommerce' ); ?>"> <?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?> </td>
How can I edit these in a way, that they display the price including tax?
I also found this snippet, but i’m not able to overwrite it with a child theme, as it’s in the includes folder of Woocommerce:
public function get_product_price( $_product ) { if ( $this->tax_display_cart == 'excl' ) { $product_price = $_product->get_price_excluding_tax(); } else { $product_price = $_product->get_price_including_tax(); } return apply_filters( 'woocommerce_cart_product_price', wc_price( $product_price ), $_product ); }
If I could set swap the “get_price_excluding_tax” and “get_price_including_tax” or maybe use these tags in a add filter hook for the above, that would be awesome.
Anyone with PHP knowledge can help me out?
Thanks!
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Shows items in excluding tax cart – with price including tax’ is closed to new replies.