20
votes
Magento 2, Change On hover instead of 'click' for mini cart
In the file
magento\vendor\magento\module-checkout\view\frontend\templates\cart\minicart.phtml (or an override magento\app\design\frontend\Custom\YourTheme\Magento_Checkout\templates\cart\minicart....
20
votes
Accepted
How to update minicart view using AJAX?
You can try the below code.
require([
'Magento_Customer/js/customer-data'
], function (customerData) {
var sections = ['cart'];
customerData.invalidate(...
17
votes
Accepted
How to add "Empty Cart" button to minicart
I have just created a proper module for your question:
We need to declare the custom js component and html template:
app/code/Vendor/MiniCart/view/frontend/layout/default.xml
<?xml version="1.0"?...
16
votes
Magento 2 Open minicart when item is added
It can be done by simply modifying minicart.js file.
Navigate to vendor/magento/Magento_Checkout/view/web/js/view/minicart.js
Create override of the file by copy it in your theme folder.
Under ...
14
votes
Accepted
remove items from cart in controller - magento2
Your custom controller should be:
namespace Gworks\Cart\Controller\Items;
use Magento\Framework\App\Action\Context;
use Magento\Checkout\Model\Cart as CustomerCart;
class Remove extends \Magento\...
13
votes
Accepted
Adding quantity increment button in cart and mini cart
app/code/Amsi/UserManagement/view/frontend/templates/cart/item/default.phtml
I have added For both increment and decrementing quantity.
You can add the button ...
12
votes
Accepted
Magento 2 show normal price with special price on minicart
You dont need to override Renderer.php file in core and you should never do in core.
You can just changes in sidebar.phtml file and set your changes.
You can get price from below method:
$finalPrice ...
10
votes
Magento 2 Add to cart frontend event listener
When something is added to the cart, the local storage information is updated and you can subscribe to a knockout observable in the cart section of the customer data to be notified when it's content ...
10
votes
Magento 2 - How to show tax and shipping costs in mini-cart pop up
To show additional stuff or costs in the minicart (like taxes or shipping costs), you need to understand where the data in the minicart comes from.
The Customer Data Section Pool
If you add a ...
9
votes
Magento 2 Get Cart Quote Total in minicart.phtml
We had a similar question from a client. where he wanted to show "[quantity] item [subtotal]" in a styled cart block instead of the default cart icon in the minicart.
We found this question here but ...
8
votes
Magento 2: Order Summary expanded on page load?
The full list of options for the collapsible widget can be seen on the dev docs here.
Finding the code
Navigate to vendor/magento/module-checkout/view/frontend/web/template/summary/cart-items.html ...
8
votes
Accepted
Magento 2 : Show cart items total to header cart link
You can display cart items sub-total to header minicart link.
Add below code to minicart.phtml to display cart items total
<span data-bind="html: getCartParam('subtotal')"></span>
php ...
8
votes
Accepted
Magento 2 Minicart - Display line item subtotal rather than unit price
You can set line item subtotal using below way, You dont need to use of knockout js anyway you can just setup your goal using below way,
You can get item qty using $qty = $item->getQty();
Now just ...
8
votes
How to modify minicart.js Magento 2?
You'd better extend the minicart component. For example:
app/code/vendor/module/view/frontend/requirejs-config.js
var config = {
'config': {
'mixins': {
'Magento_Checkout/js/...
8
votes
Magento 2.1.9 frontend font icon extend
You need open this website https://icomoon.io/app/#/select
Click on Import Icon purple button on the top choose your Luma-Icons.svg file from luma them.
You will get all icon Where you can add, edit ...
8
votes
Magento 2 How to show count 0 on mini cart when no product is in cart?
You need to override minicart.phtml in your theme on below path :
Copy From
vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml
Paste To
app/design/frontend/{Vendor}/{...
7
votes
Accepted
Magento2, echo product attribute in minicart
I found the answer to my question in this link
DefaultItem.php
<?php
namespace Your\Module\Plugin;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Catalog\Model\Product;
use ...
7
votes
Accepted
How to add Cancel/Ok button within Minicart and remove popup
First of all please override sidebar.js file in your custom theme.
So In theme, add a js file sidebar.js to app\design\frontend\[NAMESPACE]\[THEME]\Magento_Checkout\web\js\sidebar.js if not exist ...
7
votes
Accepted
Plus, Minus, automatic cart update on Magento 2.3.3
Override default.html from
vendor\magento\module-checkout\view\frontend\web\template\minicart\item\default.html
to
app\design\yourvendor\yourtheme\Magento_Checkout\web\template\minicart\item\...
6
votes
Accepted
What does the Magento 2 ko scope: 'minicart_content' reference?
This is telling knockoutJS to use the minicart_content ui component as the base object. What this means is that data-bind="html: getCartParam('subtotal') resolves to the getCartParam method found in ...
6
votes
Accepted
Magento2 mini cart item delete alert
I you are still looking for an answer, the modal confirmation is created in
vendor/magento/module-checkout/view/frontend/web/js/sidebar.js and it's a parameter named confirm:
/**
* @...
6
votes
Magento2 catch ajax complete, add to cart
I found another solution that I added via a module block.
This script catches ajax complete for "add to cart" and reads the data returned, like subtotal aso.
require(['jquery'], function ($) {
$(...
6
votes
Accepted
How to insert a UI component into the mini cart?
To anyone coming here with the same question, here's how I've done it in the end.
I found no way to solve what I thought was the correct solution, using a DataProvider, instead I injected my message ...
6
votes
Accepted
how to add quantity increment and decreament (+ and - button) in minicart magento 2?
app/design/frontend/Module/theme/Magento_Checkout/web/template/minicart/item/default.html
<div class="product-item-pricing">
<!-- ko if: canApplyMsrp -->
...
6
votes
Accepted
KnockoutJS Which Model does the Minicart use?
Open
vendor/magento/module-checkout/view/frontend/layout/default.xml
Now you can able to see how the minicart renders and how it binds with knockoutjs. Check the following code snippet.
<item ...
5
votes
Magento 2 Open minicart when item is added
Ajendra Panwar's answer is good but i wanted to point out that you can do this exact same thing without having to override the whole mini cart JS file. Doing this override can lead to upgrade problems,...
5
votes
Magento 2: How to remove Paypal Logo from MiniCart & Shopping Cart Page?
You can remove logo using backend.
Stores -> Configuration -> Sales -> Payment Method
Paypal Express Checkout Tab
Click Configure Button,
Go To Basic Settings - Paypal Express Checkout ...
5
votes
Magento 2: How to remove Paypal Logo from MiniCart & Shopping Cart Page?
Copy this file to your custom theme:
vendor/magento/module-checkout/view/frontend/web/template/minicart/content.html
to
app/design/frontend/PACKAGE/THEME/Magento_Checkout/web/template/minicart/...
5
votes
Magento 2, Change On hover instead of 'click' for mini cart
This can be done using the native data-mage-init attribute's magento functionality. As long as you include the event you can define a number of other attributes such as:
closeOnMouseLeave
...
5
votes
I want to add popup notify after adding products Magento 2
You have to override vendor/magento/module-catalog/view/frontend/web/js/catalog-add-to-cart.js..
And you can add this below script in your override catalog-add-to-cart.js
define([
'jquery',
'mage/...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mini-cart × 489magento2 × 292
cart × 86
magento-1.9 × 47
knockoutjs × 46
magento-2.1 × 42
checkout × 39
addtocart × 33
shopping-cart × 27
ajax × 22
magento2.3 × 20
javascript × 20
price × 19
product × 16
magento2.2 × 13
event-observer × 12
template × 12
magento2.4 × 11
magento2minicart × 11
overrides × 10
cache × 8
shopping-cart-price-rules × 8
jquery × 8
header × 8
configurable-product × 7