1

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?

1

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>
| improve this answer | |
  • i did this, and after, everything on the cart page dissper – Alin Lupoiu Feb 23 '17 at 9:51
  • please check is there any error? developer mode enable – Prashant Valanda Feb 23 '17 at 10:22
  • You don't need to include the layout attribute and update handles, other than that this should remove that block. – Javier Villanueva Feb 23 '17 at 16:40
  • updated code check it – Prashant Valanda Feb 24 '17 at 5:33
  • @PrashantValanda, I need to remove only shipping methods auto applying in cart page, how this can be done? – jafar pinjar Mar 18 '19 at 12:21
1

I solve this by adding: in Magento_Checkout/layoyut/checkout_index_index.xml

  <?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.root">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="checkout" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="steps" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="shipping-step" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="shippingAddress" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="shipping-address-fieldset" xsi:type="array">
                                                            <item name="children" xsi:type="array">
                                                                <!--Remove fields-->
                                                                <item name="company" xsi:type="array">
                                                                    <item name="visible" xsi:type="boolean">false</item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>

                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
        <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>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.