Hi im trying to add increment and decrement buttons to qty in minicart like that:
tried to edit Magento_Checkout/templates/cart/item/default.phtml, but it edits only the cart edit page and not the mini cart.
wich phtml file I should edit for minicart qty?
Hello @naftalayevf014
For mini-cart, the phtml file will be :
vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml
override in your theme at :
app/design/VenderName/ThemeName/Magento_Checkout/templates/cart/minicart.phtml
Hope it helps !
Let me tell you that you can find the source file of any content on the page. There is a feature template hints in magento by default. By enableing this feature you can get the path to each template that is used on the page. Template path hints can be enabled for either the storefront or the Admin.
php bin/magento dev:template-hints:enable php bin/magento dev:template-hints:disable
first of all check that you are in developer mode.
The file you need to update for the add button on minicart is
vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml
copy this file into your theme in appropriate location
app/design/frontend/Ricky/Themefront/Magento_Checkout/templates/cart/minicart.phtml
and now you can update this file.
Find helpful? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!
the thing is i cant find there the qty input field
Hello @naftalayevf014
The input field file is not actually working with php (not phtml), it's working on knockout JS file, You can find the input field html inside :
vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html
and the linked JS is :
vendor/magento/module-checkout/view/frontend/web/js/view/minicart.js
Read this blog if want to understand how knockout JS works, as it's a pain for most of the developer though
https://www.codilar.com/blog/knockoutjs-in-magento-2/
Hope it helps !!
hi @naftalayevf014
please check this link mark as accepted solution work for you
https://magento.stackexchange.com/questions/262976/how-to-add-quantity-increment-and-decreament-and-...
Find helpful ?Consider Giving Kudos to this post.
Problem solved? ClickAccept as Solution!