I have a site to buy a unique product (qty =1) so i need to eliminate Qty from mini cart, i just overrided /web/template/minicart/item/default.html : i removed div Qty but she still there any idea how to override and what to override exactly thanks in advance
- So you want to remove the qty box. Right?Sukumar Gorai– Sukumar Gorai2018-08-17 08:58:24 +00:00Commented Aug 17, 2018 at 8:58
- yes the label and the box of qtyDevelopper Magento– Developper Magento2018-08-17 08:58:54 +00:00Commented Aug 17, 2018 at 8:58
- Check my answer. You need to run the static-content deploy.Sukumar Gorai– Sukumar Gorai2018-08-17 09:06:43 +00:00Commented Aug 17, 2018 at 9:06
1 Answer
Copy the following file:
/vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html
to your theme:
app/design/frontend/Vendor/Theme/Magento_Checkout/template/minicart/item/default.html
And remove the qty code like below:
<!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <li class="item product product-item" data-role="product-item"> <div class="product"> <!-- ko if: product_has_url --> <a data-bind="attr: {href: product_url, title: product_name}" tabindex="-1" class="product-item-photo"> <!-- ko foreach: $parent.getRegion('itemImage') --> <!-- ko template: {name: getTemplate(), data: item.product_image} --><!-- /ko --> <!-- /ko --> </a> <!-- /ko --> <!-- ko ifnot: product_has_url --> <span class="product-item-photo"> <!-- ko foreach: $parent.getRegion('itemImage') --> <!-- ko template: {name: getTemplate(), data: item.product_image} --><!-- /ko --> <!-- /ko --> </span> <!-- /ko --> <div class="product-item-details"> <strong class="product-item-name"> <!-- ko if: product_has_url --> <a data-bind="attr: {href: product_url}, text: product_name"></a> <!-- /ko --> <!-- ko ifnot: product_has_url --> <!-- ko text: product_name --><!-- /ko --> <!-- /ko --> </strong> <!-- ko if: options.length --> <div class="product options" data-mage-init='{"collapsible":{"openedState": "active", "saveState": false}}'> <span data-role="title" class="toggle"><!-- ko i18n: 'See Details' --><!-- /ko --></span> <div data-role="content" class="content"> <strong class="subtitle"><!-- ko i18n: 'Options Details' --><!-- /ko --></strong> <dl class="product options list"> <!-- ko foreach: { data: options, as: 'option' } --> <dt class="label"><!-- ko text: option.label --><!-- /ko --></dt> <dd class="values"> <!-- ko if: Array.isArray(option.value) --> <span data-bind="html: option.value.join('<br>')"></span> <!-- /ko --> <!-- ko ifnot: Array.isArray(option.value) --> <span data-bind="html: option.value"></span> <!-- /ko --> </dd> <!-- /ko --> </dl> </div> </div> <!-- /ko --> <div class="product-item-pricing"> <!-- ko if: canApplyMsrp --> <div class="details-map"> <span class="label" data-bind="i18n: 'Price'"></span> <span class="value" data-bind="i18n: 'See price before order confirmation.'"></span> </div> <!-- /ko --> <!-- ko ifnot: canApplyMsrp --> <!-- ko foreach: $parent.getRegion('priceSidebar') --> <!-- ko template: {name: getTemplate(), data: item.product_price, as: 'price'} --><!-- /ko --> <!-- /ko --> <!-- /ko --> </div> <div class="product actions"> <!-- ko if: is_visible_in_site_visibility --> <div class="primary"> <a data-bind="attr: {href: configure_url, title: $t('Edit item')}" class="action edit"> <span data-bind="i18n: 'Edit'"></span> </a> </div> <!-- /ko --> <div class="secondary"> <a href="#" data-bind="attr: {'data-cart-item': item_id, title: $t('Remove item')}" class="action delete"> <span data-bind="i18n: 'Remove'"></span> </a> </div> </div> </div> </div> </li> Now run static-content deploy and check.
For Checkout Cart Page:
Copy the file
/vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml
to your theme:
app/design/frontend/Vendor/Theme/Magento_Checkout/templates/cart/form.phtml
and remove the Qty from table head.
Now copy the file
/vendor/magento/module-checkout/view/frontend/templates/cart/item/default.phtml
to your theme:
app/design/frontend/Vendor/Theme/Magento_Checkout/templates/cart/item/default.phtml
And remove the Qty block.
Refresh the cache and check.
- thanks for your replay, i will check this code immediatlyDevelopper Magento– Developper Magento2018-08-17 09:09:35 +00:00Commented Aug 17, 2018 at 9:09
- still there !!!!Developper Magento– Developper Magento2018-08-17 09:12:37 +00:00Commented Aug 17, 2018 at 9:12
- i think that there is another template that we need to override do you have any idea and thanks in advanceDevelopper Magento– Developper Magento2018-08-17 09:13:51 +00:00Commented Aug 17, 2018 at 9:13
- Can you goto pub/static/frontend/Vendor/Theme/en_US/Magento_Checkout/template/minicart/item/default.html and delete that file and run static content deploy again. It should work.Sukumar Gorai– Sukumar Gorai2018-08-17 09:14:10 +00:00Commented Aug 17, 2018 at 9:14
- Do you mean pub/static/frontend/magento/luma /en_US/Magento_checkout/template/minicart/item/default.htmlDevelopper Magento– Developper Magento2018-08-17 09:18:21 +00:00Commented Aug 17, 2018 at 9:18