diff --git a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/order-summary/order-summary-item.js b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/order-summary/order-summary-item.js index d376e05e136..7ce9a95535f 100644 --- a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/order-summary/order-summary-item.js +++ b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/order-summary/order-summary-item.js @@ -9,6 +9,7 @@ import { getCurrency } from '@woocommerce/price-format'; import { __experimentalApplyCheckoutFilter } from '@woocommerce/blocks-checkout'; import PropTypes from 'prop-types'; import Dinero from 'dinero.js'; +import { DISPLAY_CART_PRICES_INCLUDING_TAX } from '@woocommerce/block-settings'; /** * Internal dependencies @@ -60,8 +61,13 @@ const OrderSummaryItem = ( { cartItem } ) => { .convertPrecision( priceCurrency.minorUnit ) .getAmount(); const totalsCurrency = getCurrency( totals ); + + let lineTotal = parseInt( totals.line_total, 10 ); + if ( DISPLAY_CART_PRICES_INCLUDING_TAX ) { + lineTotal += parseInt( totals.line_total_tax, 10 ); + } const totalsPrice = Dinero( { - amount: parseInt( totals.line_total, 10 ), + amount: lineTotal, } ) .convertPrecision( totals.currency_minor_unit ) .getAmount(); diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/cart/full-cart/cart-line-item-row.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/cart/full-cart/cart-line-item-row.js index 7d9db883297..66e29f58a50 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/cart/full-cart/cart-line-item-row.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/cart/full-cart/cart-line-item-row.js @@ -18,6 +18,7 @@ import { import { getCurrency } from '@woocommerce/price-format'; import { __experimentalApplyCheckoutFilter } from '@woocommerce/blocks-checkout'; import Dinero from 'dinero.js'; +import { DISPLAY_CART_PRICES_INCLUDING_TAX } from '@woocommerce/block-settings'; /** * @typedef {import('@woocommerce/type-defs/cart').CartItem} CartItem @@ -81,6 +82,7 @@ const CartLineItemRow = ( { lineItem = {} } ) => { currency_decimal_separator: '.', currency_thousand_separator: ',', line_total: '0', + line_total_tax: '0', }, extensions, } = lineItem; @@ -117,8 +119,12 @@ const CartLineItemRow = ( { lineItem = {} } ) => { ); const saleAmount = saleAmountSingle.multiply( quantity ); const totalsCurrency = getCurrency( totals ); + let lineTotal = parseInt( totals.line_total, 10 ); + if ( DISPLAY_CART_PRICES_INCLUDING_TAX ) { + lineTotal += parseInt( totals.line_total_tax, 10 ); + } const totalsPrice = Dinero( { - amount: parseInt( totals.line_total, 10 ), + amount: lineTotal, } ); const firstImage = images.length ? images[ 0 ] : {};