1

I want to remove or hide the shipping in order summary like in the picture below, because it will always free shipping. How can i remove it? enter image description here

3
  • If you are using custom theme, one option is to hide it in your custom theme. just hide it using css.
    – Korbin
    Commented Nov 13, 2017 at 7:29
  • No i dont use custom theme. Commented Nov 13, 2017 at 7:37
  • then according to magento docs you should create a a new theme inheriting from Magento Blank or Luma. This is the simplest way available. devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-guide/… Editing the core magento theme is not a good idea, since you changes will be overwritten by update
    – Korbin
    Commented Nov 13, 2017 at 7:41

4 Answers 4

0

Please check the path and use below code. This may help you.

vendor/magento/theme-frontend-blank/Magento_Checkout/layout/checkout_cart_index.xml
<referenceBlock name="shipping-information" display="false" />
1
  • The shipping method is still there, it's not work. Commented Nov 13, 2017 at 11:08
0

This price and Shipping carrier name is coming from JS file and not the PHTML file. you can find JS file at below location

/vendor/magento/module-checkout/view/frontend/web/js/view/summary/shipping.js

0

Disable shipping UI component thru XML layout file

override the XML file in your custom theme and disable the shipping component.

app/design/frontend/ThemeVendor/Theme/Magento_Checkout/layout/checkout_index_index.xml

<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.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="sidebar" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="summary" xsi:type="array">
                                                <item name="children" xsi:type="array">
                                                    <item name="totals" xsi:type="array">
                                                        <item name="children" xsi:type="array">
                                                            <!--Remove fields-->
                                                            <item name="shipping" xsi:type="array">
                                                                <item name="config" xsi:type="array">
                                                                    <item name="componentDisabled" xsi:type="boolean">true</item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </argument>
                </arguments>
            </referenceBlock>
        </body>
    </page>
0

Create a layout file named checkout_index_index.xml under your module/theme's view/frontend/layout/ directory, and use this code to remove the shipping component from the Checkout page:

<?xml version="1.0"?>
<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.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="sidebar" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="summary" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="totals" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="shipping" xsi:type="array">
                                                            <item name="componentDisabled" xsi:type="boolean">true</item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

As you mentioned, your website is always going to offer free shipping, so you might want to remove the shipping section from Cart page as well. If a customer reaches Shipping step, selects a Shipping method and then eventually goes back to Cart page, another Shipping line will show up in Cart Summary section. enter image description here

To remove this Shipping at Cart page, create another layout file named checkout_cart_index.xml also under your module/theme's view/frontend/layout/ directory, and use this code below:

<?xml version="1.0"?>
<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">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="block-summary" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="block-rates" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="price" xsi:type="array">
                                            <item name="componentDisabled" xsi:type="boolean">true</item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
        <referenceBlock name="checkout.cart.totals">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="block-totals" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="shipping" xsi:type="array">
                                    <item name="componentDisabled" xsi:type="boolean">true</item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

Then finally clear the cache using command php bin/magento cache:clean and refresh to page to see the result.

Let me know if my answer helps or there is any mistake.

Happy coding!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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