Tax block in cart page of Magento 2

I am explaining here a way to remove the estimated tax block seen in the summary section of cart page

Create a file checkout_cart_index.xml at the location app/design/frontend/Dw/green/Magento_Checkout/layout/ (Dw/green is a custom theme)

Copy the content as seen below in the layout file

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
	<body>
	<referenceBlock name="checkout.cart.shipping">
	    <arguments>
	        <argument name="jsLayout" xsi:type="array">
	            <item name="components" xsi:type="array">
	                <item name="block-summary" xsi:type="array">
	                    <item name="config" xsi:type="array">
	                        <item name="componentDisabled" xsi:type="boolean">true</item>
	                    </item>
	
	                </item>
	            </item>
	        </argument>
	    </arguments>
	</referenceBlock>
	</body>
</page>

Also in case you want to remove the heading as well than copy vendor/magento/module-checkout/view/frontend/templates/cart/shipping.phtml file to app/design/frontend/Dw/green/Magento_Checkout/templates/cart and comment/remove the below mentioned part

<div class="title" data-role="title">
        <strong id="block-shipping-heading" role="heading" aria-level="2">
            <?= /* @escapeNotVerified */ $block->getQuote()->isVirtual() ? __('Estimate Tax') : __('Estimate Shipping and Tax') ?>
        </strong>
    </div>

Hope this is helpful

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top