Check if there are tax lines before rendering the container for them (https://github.com/woocommerce/woocommerce-blocks/pull/4284)
This commit is contained in:
parent
f0cb4cba90
commit
1702a6c0c3
|
@ -45,29 +45,30 @@ const TotalsTaxes = ( {
|
|||
false
|
||||
) as boolean;
|
||||
|
||||
const itemisedTaxItems: ReactElement | null = showItemisedTaxes ? (
|
||||
<div
|
||||
className={ classnames(
|
||||
'wc-block-components-totals-taxes',
|
||||
className
|
||||
) }
|
||||
>
|
||||
{ taxLines.map( ( { name, rate, price }, i ) => {
|
||||
const label = `${ name }${
|
||||
showRateAfterTaxName ? ` ${ rate }` : ''
|
||||
}`;
|
||||
return (
|
||||
<TotalsItem
|
||||
key={ `tax-line-${ i }` }
|
||||
className="wc-block-components-totals-taxes__grouped-rate"
|
||||
currency={ currency }
|
||||
label={ label }
|
||||
value={ parseInt( price, 10 ) }
|
||||
/>
|
||||
);
|
||||
} ) }{ ' ' }
|
||||
</div>
|
||||
) : null;
|
||||
const itemisedTaxItems: ReactElement | null =
|
||||
showItemisedTaxes && taxLines.length > 0 ? (
|
||||
<div
|
||||
className={ classnames(
|
||||
'wc-block-components-totals-taxes',
|
||||
className
|
||||
) }
|
||||
>
|
||||
{ taxLines.map( ( { name, rate, price }, i ) => {
|
||||
const label = `${ name }${
|
||||
showRateAfterTaxName ? ` ${ rate }` : ''
|
||||
}`;
|
||||
return (
|
||||
<TotalsItem
|
||||
key={ `tax-line-${ i }` }
|
||||
className="wc-block-components-totals-taxes__grouped-rate"
|
||||
currency={ currency }
|
||||
label={ label }
|
||||
value={ parseInt( price, 10 ) }
|
||||
/>
|
||||
);
|
||||
} ) }{ ' ' }
|
||||
</div>
|
||||
) : null;
|
||||
|
||||
return showItemisedTaxes ? (
|
||||
itemisedTaxItems
|
||||
|
|
Loading…
Reference in New Issue