0

Hello I want to override magento 2 Mini cart UIComponent's Text from qty to Quantity please tell How to do so Thanks,

Adarsh Shukla
  • 573
  • 1
  • 7
  • 25

2 Answers2

2

Assume, you are using a custom theme Vendor_YourTheme

Please copy

YOUR-MAGENTO-ROOT/vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html

Paste into your custom theme.

YOUR-MAGENTO-ROOT/app/design/frontend/Vendor/YourTheme/Magento_Checkout/web/template/minicart/item/default.html

Now replace label "Qty" with "Quantity" as follows:

<label class="label" data-bind="i18n: 'Quantity', attr: {
                           for: 'cart-item-'+item_id+'-qty'}">
</label>

Please empty your pub/static/frontend/ folder by running below command and flush Magento cache.

sudo rm -rf pub/static/frontend/*
sudo php bin/magento cache:flush

Note: To display mini-cart "quantity" label properly, you may need to adjust some css class.

enter image description here

fmsthird
  • 4,592
  • 4
  • 17
  • 41
Pritam Biswas
  • 2,602
  • 1
  • 9
  • 11
  • if i want do do it in code folder? not in design – Adarsh Shukla Nov 30 '18 at 07:11
  • @AdarshShukla It is more simple and straightforward to do this customisation in template instead code folder .if you want to do it in a code folder then you may need to overwrite KO template html file for the JS component "item.renderer". You can see the xml file ( YOUR-MAGENTO-ROOT/vendor/magento/module-checkout/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml ) where "default.html" template assigned to mini-cart "item.renderer" component. – Pritam Biswas Nov 30 '18 at 08:26
0

Go to

System > Configuration > Advanced > Developer > Translate Inline

Select Enable for Storefront to Yes.

No go to frontend and you will see selectable items for every block that can be translated. Select Cart icon, click on the book icon. Then change the text, and save.

Note - In case translate items are not reflected you can fush cachen and run deployment command and retry

Another way of doing can be(I have not tried) Simple override Checkout module like Magento_Checkout in your custom theme folder, and copy/paste folder i18n, and there write text like -

"Qty","Quantity"
Gagan
  • 1,478
  • 13
  • 32