From abed796bd64cec413f30020d0721cb9ce8d17a52 Mon Sep 17 00:00:00 2001 From: Bartosz Budzanowski Date: Mon, 26 Oct 2020 11:34:30 +0100 Subject: [PATCH] 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. --- .../cart-checkout/totals/totals-footer-item/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/totals/totals-footer-item/index.js b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/totals/totals-footer-item/index.js index 14c2602079f..5792a781778 100644 --- a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/totals/totals-footer-item/index.js +++ b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/totals/totals-footer-item/index.js @@ -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 && (

{ createInterpolateElement( __(