Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Update MiniCart.php to fix price total amount on page load prices are including tax #7832

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/BlockTypes/MiniCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ protected function get_cart_price_markup( $attributes ) {
$cart_controller = $this->get_cart_controller();
$cart = $cart_controller->get_cart_instance();
$cart_contents_total = $cart->get_subtotal();

if ( $cart->display_prices_including_tax() ) {
$cart_contents_total += $cart->get_subtotal_tax();
}

return '<span class="wc-block-mini-cart__amount">' . esc_html( wp_strip_all_tags( wc_price( $cart_contents_total ) ) ) . '</span>
' . $this->get_include_tax_label_markup();
}
Expand Down