Question

I have attempted to follow lots of answers on here which cover overriding the minicart via a new extension/module.

I have successfully removed all the edit links from the cart by adding the file: checkout_cart_index.xml to this location: /app/design/frontend/BlackRhino/luma/Magento_Checkout/layout/

Which looks like this:

<?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">
<update handle="checkout_cart_item_renderers"/>
    <body>
    <referenceBlock name="checkout.cart.item.renderers.default.actions.edit" remove="true"/>
    <referenceBlock name="checkout.cart.item.renderers.configurable.actions.edit" remove="true"/>
    <referenceBlock name="checkout.cart.item.renderers.simple.actions.edit" remove="true"/>
    <referenceBlock name="checkout.cart.item.renderers.virtual.actions.edit" remove="true"/>
    <referenceBlock name="checkout.cart.item.renderers.giftcard.actions.edit" remove="true"/>
    <referenceBlock name="checkout.cart.item.renderers.grouped.actions.edit" remove="true"/>
    <referenceBlock name="checkout.cart.item.renderers.downloadable.actions.edit" remove="true"/>
    <referenceBlock name="checkout.cart.item.renderers.bundle.actions.edit" remove="true"/>
</body>

Can I do the same for the minicart?

I have tried copying the file from this location: /vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html

Various locations seem to be suggested: /app/design/frontend/BlackRhino/luma/Magento_Checkout/web/template/minicart/item/ /app/design/frontend/BlackRhino/Magento_Checkout/web/template/minicart/item /app/code/BlackRhino/BlackForest/template/minicart/item/

I've tried all of these locations with deploying static content (although its in developer mode) but the pencil prevails.

I don't know if things have changed recently, quite alot of the questions appear to be 3-4 years old in some cases and I wonder if the recent changes now require a slightly different approach?

I have also tried to override this file: /vendor/magento/module-checkout/view/frontend/requirejs-config.js by placing one here with an alternative location like this:

var config = {
map: {
    '*': {
        'Magento_Checkout/template/minicart/content.html':
            'BlackRhino_BlackForest/template/minicart/content.html'
    }
}

};

but this answer Magento 2: How to override mini-cart default template html file? doesn't make it clear where the alternative file should be located and again is 5+ years old.

I wonder if someone could put me out my misery and tell me where I have gone wrong and which one of these solutions should work and how I can get it to work please?

Was it helpful?

Solution

Place defalt.phtml to below path

app/design/frontend/BlackRhino/luma/Magento_Checkout/web/template/minicart/item/

and make require changes in html to remove the edit action.

Do static-content:deploy

php bin:magento setup:static-content:deploy

You can further check whether this file is overridden through theme by navigating to

pub/static/frontend/BlackRhino/luma/en_US/Magento_Checkout/template/minicart/item/default.html

Follow this link for reference

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top