File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -184,8 +184,8 @@ export const cart = computed({
184184 refresh ( )
185185 }
186186
187- cartStorage . value . fixedProductTaxes = fixedProductTaxes
188- cartStorage . value . taxTotal = taxTotal
187+ cartStorage . value . fixedProductTaxes = fixedProductTaxes ( cartStorage . value )
188+ cartStorage . value . taxTotal = taxTotal ( cartStorage . value )
189189
190190 return cartStorage . value
191191 } ,
@@ -254,22 +254,22 @@ export const cart = computed({
254254 } ,
255255} )
256256
257- export const fixedProductTaxes = computed ( ( ) => {
257+ export const fixedProductTaxes = ( cart ) => {
258258 let taxes = { }
259259 // Note: Magento does internal rounding before multiplying by the quantity, so we actually don't lose any precision here by using the rounded tax amount.
260- cart . value ?. items ?. forEach ( ( item ) =>
260+ cart ?. items ?. forEach ( ( item ) =>
261261 item . prices ?. fixed_product_taxes ?. forEach ( ( tax ) => ( taxes [ tax . label ] = ( taxes [ tax . label ] ?? 0 ) + tax . amount . value * item . quantity ) ) ,
262262 )
263263 return taxes
264- } )
264+ }
265265
266- export const taxTotal = computed ( ( ) => {
267- if ( ! cart ?. value ?. prices ?. applied_taxes ?. length ) {
266+ export const taxTotal = ( cart ) => {
267+ if ( ! cart ?. prices ?. applied_taxes ?. length ) {
268268 return 0
269269 }
270270
271- return cart . value . prices . applied_taxes . reduce ( ( sum , tax ) => sum + tax . amount . value , 0 )
272- } )
271+ return cart . prices . applied_taxes . reduce ( ( sum , tax ) => sum + tax . amount . value , 0 )
272+ }
273273
274274watch ( mask , refresh )
275275if ( cartStorage . value ?. id && ! mask . value ) {
Original file line number Diff line number Diff line change 2323 </div >
2424 </template >
2525
26- <template v-if =" cart.fixedProductTaxes?.value " >
26+ <template v-if =" cart.fixedProductTaxes" >
2727 <div v-for =" value, label in cart.fixed_product_taxes" >
2828 <dt >@ {{ label }}</dt >
2929 <dd >@ {{ value | price }}</dd >
4040 <div class =" border-t pt-3 mt-3 font-bold" >
4141 <dt >@lang (' Total' )</dt >
4242 <dd v-if =" showTax" >@ {{ cart.prices.grand_total.value | price }}</dd >
43- <dd v-else >@ {{ cart.prices.grand_total.value - cart.taxTotal.value | price }}</dd >
43+ <dd v-else >@ {{ cart.prices.grand_total.value - cart.taxTotal | price }}</dd >
4444 </div >
4545</x-rapidez::summary >
4646
You can’t perform that action at this time.
0 commit comments