File "block.tsx"
Full Path: /home/warrior1/public_html/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.tsx
File size: 987 bytes
MIME-type: text/x-java
Charset: utf-8
/**
* External dependencies
*/
import { TotalsTaxes, TotalsWrapper } from '@woocommerce/blocks-checkout';
import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
import { useStoreCart } from '@woocommerce/base-context/hooks';
import { getSetting } from '@woocommerce/settings';
const Block = ( {
className,
showRateAfterTaxName,
}: {
className: string;
showRateAfterTaxName: boolean;
} ): JSX.Element | null => {
const { cartTotals } = useStoreCart();
const displayCartPricesIncludingTax = getSetting(
'displayCartPricesIncludingTax',
false
);
if (
displayCartPricesIncludingTax ||
parseInt( cartTotals.total_tax, 10 ) <= 0
) {
return null;
}
const totalsCurrency = getCurrencyFromPriceResponse( cartTotals );
return (
<TotalsWrapper className={ className }>
<TotalsTaxes
showRateAfterTaxName={ showRateAfterTaxName }
currency={ totalsCurrency }
values={ cartTotals }
/>
</TotalsWrapper>
);
};
export default Block;