1

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>
        </span>
    </span>
    <span class="text cart-title"><?php /* @escapeNotVerified */ echo __('Your Cart'); ?></span>
    <span class="text" data-bind="html: getCartParam('subtotal')"></span>
</a>

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

0

Please try with below path and change code :

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

app/design/frontend/Themes/Yourtheme/Magento/Checkout/view/frontend/web/template/minicart/item/default.html

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 :

app\design\frontend\Themes\Yourtheme\etc\view.xml

<image id="mini_cart_product_thumbnail" type="thumbnail">
    <width>75</width>
    <height>75</height>
</image>

to replace with :

<image id="mini_cart_product_thumbnail" type="small_image">
    <width>75</width>
    <height>75</height>
</image>
| improve this answer | |
  • 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 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.