Respect Enable Taxes setting for checkout block taxe display. (https://github.com/woocommerce/woocommerce-blocks/pull/3291)

* Respect Enable Taxes setting for checkout block taxes display.

* Refactor logic into a named const.
This commit is contained in:
Bartosz Budzanowski 2020-10-26 11:34:30 +01:00 committed by GitHub
parent e1bfb747f9
commit abed796bd6
1 changed files with 7 additions and 2 deletions

View File

@ -2,7 +2,10 @@
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { DISPLAY_CART_PRICES_INCLUDING_TAX } from '@woocommerce/block-settings';
import {
TAXES_ENABLED,
DISPLAY_CART_PRICES_INCLUDING_TAX,
} from '@woocommerce/block-settings';
import { createInterpolateElement } from 'wordpress-element';
import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount';
import PropTypes from 'prop-types';
@ -13,6 +16,8 @@ import PropTypes from 'prop-types';
import TotalsItem from '../totals-item';
import './style.scss';
const SHOW_TAXES = TAXES_ENABLED && DISPLAY_CART_PRICES_INCLUDING_TAX;
const TotalsFooterItem = ( { currency, values } ) => {
const { total_price: totalPrice, total_tax: totalTax } = values;
@ -23,7 +28,7 @@ const TotalsFooterItem = ( { currency, values } ) => {
label={ __( 'Total', 'woo-gutenberg-products-block' ) }
value={ parseInt( totalPrice, 10 ) }
description={
DISPLAY_CART_PRICES_INCLUDING_TAX && (
SHOW_TAXES && (
<p className="wc-block-components-totals-footer-item-tax">
{ createInterpolateElement(
__(