This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
base/components/cart-checkout/order-summary
blocks/cart-checkout/cart/full-cart Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { getCurrency } from '@woocommerce/price-format';
99import { __experimentalApplyCheckoutFilter } from '@woocommerce/blocks-checkout' ;
1010import PropTypes from 'prop-types' ;
1111import Dinero from 'dinero.js' ;
12+ import { DISPLAY_CART_PRICES_INCLUDING_TAX } from '@woocommerce/block-settings' ;
1213
1314/**
1415 * Internal dependencies
@@ -60,8 +61,13 @@ const OrderSummaryItem = ( { cartItem } ) => {
6061 . convertPrecision ( priceCurrency . minorUnit )
6162 . getAmount ( ) ;
6263 const totalsCurrency = getCurrency ( totals ) ;
64+
65+ let lineTotal = parseInt ( totals . line_total , 10 ) ;
66+ if ( DISPLAY_CART_PRICES_INCLUDING_TAX ) {
67+ lineTotal += parseInt ( totals . line_total_tax , 10 ) ;
68+ }
6369 const totalsPrice = Dinero ( {
64- amount : parseInt ( totals . line_total , 10 ) ,
70+ amount : lineTotal ,
6571 } )
6672 . convertPrecision ( totals . currency_minor_unit )
6773 . getAmount ( ) ;
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818import { getCurrency } from '@woocommerce/price-format' ;
1919import { __experimentalApplyCheckoutFilter } from '@woocommerce/blocks-checkout' ;
2020import Dinero from 'dinero.js' ;
21+ import { DISPLAY_CART_PRICES_INCLUDING_TAX } from '@woocommerce/block-settings' ;
2122
2223/**
2324 * @typedef {import('@woocommerce/type-defs/cart').CartItem } CartItem
@@ -81,6 +82,7 @@ const CartLineItemRow = ( { lineItem = {} } ) => {
8182 currency_decimal_separator : '.' ,
8283 currency_thousand_separator : ',' ,
8384 line_total : '0' ,
85+ line_total_tax : '0' ,
8486 } ,
8587 extensions,
8688 } = lineItem ;
@@ -117,8 +119,12 @@ const CartLineItemRow = ( { lineItem = {} } ) => {
117119 ) ;
118120 const saleAmount = saleAmountSingle . multiply ( quantity ) ;
119121 const totalsCurrency = getCurrency ( totals ) ;
122+ let lineTotal = parseInt ( totals . line_total , 10 ) ;
123+ if ( DISPLAY_CART_PRICES_INCLUDING_TAX ) {
124+ lineTotal += parseInt ( totals . line_total_tax , 10 ) ;
125+ }
120126 const totalsPrice = Dinero ( {
121- amount : parseInt ( totals . line_total , 10 ) ,
127+ amount : lineTotal ,
122128 } ) ;
123129
124130 const firstImage = images . length ? images [ 0 ] : { } ;
You can’t perform that action at this time.
0 commit comments