2

As the title says, how can I remove the summary to the right of the shopping cart in Magento 2?

I was hoping for a solution using XML Layout, but any solution will do (other than hiding it once its got to the client with CSS or Javascript).

  • Do taking about cart summary? – Amit Bera Apr 21 '16 at 14:26
  • @AmitBera Yes, it appears on the right of the shopping cart product grid on the shopping cart page (at least, that's where it appears in the Luma theme) – Jimmery Apr 21 '16 at 15:01
3

Be careful with some answers on here, do not edit Magento's core files such as the blank theme! Always extend or overwrite them.

Extending the blank theme

To make your change without editing Magento's core files you will need to extend the blank theme. To do this create the following file:

app/design/frontend/**PACKAGE-NAME**/**THEME-NAME**/Magento_Checkout/layout/checkout_cart_index.xml

Removing the block

In here add the following code to remove the block:

<?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="cart.summary" remove="true" />
    </body>
</page>

Luma summary - cart page

Extra info

The original code responsible for rendering this block can be found in vendor/magento/theme-frontend-blank/Magento_Checkout/layout/checkout_cart_index.xml

I wouldn't advise removing the summary unless you're going to add some of the functionality back, it would make for a bad user experience especially as it removes the checkout button and extra pricing info.

| improve this answer | |
0

By default the Summary title block is added via file:

vendor/magento/theme-frontend-blank/Magento_Checkout/layout/checkout_cart_index.xml

You can hide this block with layout instruction:

<referenceBlock name="checkout.cart.summary.title" display="false" />
| improve this answer | |
  • Won't that only remove the summary title? Also you should never edit the blank theme directly, you should always extend or overwrite the files within your own theme. And display false will not completely remove the block, the block's/container's and its children's respective PHP objects are still generated and available for manipulation. 'remove="true"' is the better option here. – Ben Crook Apr 21 '16 at 19:21
0

To remove it from the sidebar, you can do it in the html file.

Remove

<!-- ko foreach: getRegion('summary') -->
<!-- ko template: getTemplate() --><!-- /ko -->

from the file

vendor/magento/module-checkout/view/frontend/web/template/sidebar.html

Note: Donot work on the core file. Copy the file to your theme and work on that.

| improve this answer | |
-1

Copy the layout/default.xml from checkout module and paste this to your_theme foldr/Magento_Checkout/layout folder then comment <arguments></arguments> located just behind of

<block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="custom_header" template="cart/minicart.phtml">.

Then clear cache, delete pub/static/frontend folder and

var/view_preprocessed` folder and run `php bin/magento setup:static-content:deploy.

Hope this will work for you also as the way it work for me.

| improve this answer | |
  • sorry but commenting these arguments out didnt work. I removed the entire block minicart and that didnt work either. – Jimmery Apr 21 '16 at 15:00
  • It is unnecessary to copy the file when you can extend it. – Ben Crook Apr 21 '16 at 19:22

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.