Magento – How to i remove shipping.phtml from cart page on Magento 2

cartcheckoutmagento2xml

I try to remove shipping.phtml from cart page shipping.phtml

I tried to diseable this field from module-checkout\view\frontend\layout\checkout_cart_index.xml

 <block class="Magento\Checkout\Block\Cart\Shipping" name="checkout.cart.shipping" as="shipping" template="cart/shipping.phtml" after="checkout.cart.summary.title">
<referenceBlock name="checkout.cart.shipping" remove="true" /> 

by adding <referenceBlock name="checkout.cart.shipping" remove="true" /> , but it dosen't work.

Does anyone know if it's another way do disable this phtml?

Best Answer

Add checkout_cart_index.xml file in your custom module at app/code/Vendor/Modulename/view/frontend/layout/checkout_cart_index.xml

add below code to it.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.cart.shipping" remove="true" />
    </body>
</page>