I need to remove the width and height of the picture in mini-cart pages. I have checked about Magento developer document. I realize I can set up in view.xml to change the width and height, but here is the problem while I configure the width and the height in the view.xml the pic is stretched. I also checked about code (See below code). It's written by knockout js

    <a class="action showcart" title="<?= $block->escapeHtml(__('My Basket')) ?>" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
   data-bind="scope: 'minicart_content'">
    <span class="crat-icon">
        <span class="counter qty empty"
              data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading">
            <span class="counter-number"><!-- ko text: getCartParam('summary_count') --><!-- /ko --></span>
            <span class="counter-label">
            <!-- ko if: getCartParam('summary_count') -->
                <!-- ko text: getCartParam('summary_count') --><!-- /ko -->
                <!-- ko i18n: 'items' --><!-- /ko -->
            <!-- /ko -->
    <span class="text cart-title"><?php /* @escapeNotVerified */ echo __('Your Cart'); ?></span>
    <span class="text" data-bind="html: getCartParam('subtotal')"></span>

Are any solutions that I can remove the width and height in the mini cart page?


Please try with below path and change code :

If you want to remove image than check with below path :


if file not exist than copy from default Magento path than paste above path

default magento path : vendor\magento\module-checkout\view\frontend\web\template\minicart\item\default.html

OR If you want resize than do with below step :


<image id="mini_cart_product_thumbnail" type="thumbnail">

to replace with :

<image id="mini_cart_product_thumbnail" type="small_image">
  • Thanks for your solutions!!! Since the mini cart pic is distorted after I setting view.xml width and height. So it seems I have to remove the width and height in the Html file which is controlled by knockout js, but here is the problem that even though I console.log the data, I still have no idea about how to remove the width and height before render. – Ocen May 4 '20 at 5:05

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.