27

You can create a module to do this. It will use a plugin to add the attributes to the data array which is read by the knockout js template. Then we need to override the template to display these values. This is the module directory: | registration.php | +---etc | | module.xml | | catalog_attributes.xml | | | \---frontend | di....


21

You have to do setting from admin panel. GO to Admin panel, Stores -> Configuration -> Sales -> Checkout -> Shopping Cart -> Configurable Product Image Set Product Thumbnail itself from dropdown list. Save Confiration.


17

You have to just keep below line in your minicart.phtml file to get updated subtotal , This Below line is workig for all cases if cache is enable its working fine, <span data-bind="html: getCartParam('subtotal')"></span> For getting value of grandtotal,shipping rate, You can get GrandTotal, subtotal and shipping rate for current quote ...


17

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.phtml) in the data-mage-init attribute use the following: "triggerEvent": "hover" "closeOnMouseLeave": true and remove "timeout": "2000" Example code: <div ...


15

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"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/...


14

You can try the below code. require([ 'Magento_Customer/js/customer-data' ], function (customerData) { var sections = ['cart']; customerData.invalidate(sections); customerData.reload(sections, true); });


12

As far as I know, the header minicart will get the data from customer data vendor/magento/module-checkout/view/frontend/web/js/view/minicart.js define([ 'uiComponent', 'Magento_Customer/js/customer-data', 'jquery', 'ko', 'sidebar' ], function (Component, customerData, $, ko) { 'use strict'; ...... this.cart = customerData....


12

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 near Quantiy using below code. <div class="control qty"> <input id="cart-<?= /* @escapeNotVerified */ $_item->getId()...


11

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\Framework\App\Action\Action { /** * @var \Magento\Checkout\Model\Session */ protected $checkoutSession; /** * @var \Magento\Checkout\...


11

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 initialize: function, you will see $('[data-block="minicart"]').on('contentLoading', function (event) { Replace the function with this code. $('[data-block="...


11

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 = $item->getProduct()->getFinalPrice(); $normalPrice = $item->getProduct()->getPrice(); After getting above changes you can do it below code in ...


9

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 didn't like the answer where we needed to extend the \Magento\Checkout\CustomerData\Cart class just to render some html correctly this is the code how we fixed ...


8

try this $helper = $this->helper('\Magento\Checkout\Helper\Cart'); echo $helper->getItemsCount();


8

Not Tried but you can add directly in phtml with below code <?php echo $this->getLayout() ->createBlock('Magento\Checkout\Block\Cart\Sidebar') ->setTemplate('Magento_Checkout::cart/minicart.phtml') ->toHtml(); ?>


8

There is a temporary solution for you, we need to override vendor/magento/module-checkout/view/frontend/web/js/view/payment/default.js because if we take a look at this file, we can see: /** * After place order callback */ afterPlaceOrder: function () { // Override this function and put after place order logic ...


8

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 you have to set $block->getUnitDisplayPriceInclTax()*$qty to get lineItem subtotal for each item. You just need to override template file into your theme ...


8

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 and updates your icons. Than click on generate font button on bottom Than replace fonts your them. php bin/magento s:s:d -f and php bin/magento c:f


7

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 and look at line 8 (on 2.1.1 at least), it should look like so: <div class="block items-in-cart" data-bind="mageInit: {'collapsible':{'openedState': 'active'}...


7

Firstly, very good explanation from @Khoa TruongDinh about the flow of getting item in minicart template. how can I change them around to add or remove product details? I found a way how you can extend minicart template with custom attributes of the product. To do that first you need to override vendor/magento/module-checkout/CustomerData/DefaultItem....


7

Why you don't try to move it with xml update. Add this to default.xml layout in your theme: <move element="minicart" destination="navigation.sections" /> The navigation.sections block is defined in vendor/magento/theme-frontend-blank/Magento_Theme/layout/default.xml. Then you need to override sections.phtml in your theme app/design/frontend/Vendor/...


7

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 product to the cart, you can see in your inspector a XHR request is made to /customer/section/load with the arguments ?sections=cart,messages. This controller checks ...


7

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/view/minicart': { 'Vendor_Module/js/checkout/view/minicart': true } } } }; app/code/vendor/module/view/frontend/web/js/...


7

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 then copy form vendor\magento\module-checkout\view\frontend\web\js\sidebar.js Now go to button.remove function in sidebar.js on line number 89 approx, and replace ...


6

You have two options, Disable form keys for the remove action. There is no real risk in doing this, the CSRF protection the form keys add have limited scope for damage when removed on cart actions. You could use this module as a basis if you wanted to script something Change the remove link to use getUrl('checkout/cart/ajaxDelete', array(..., ...


6

registration.php file, filepath app/code/Package/Modulename/registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Package_Modulename', __DIR__ ); composer.json file, app/code/Package/Modulename/composer.json { "name": "package/magento2-modulename", ...


6

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 bin/magento cache:clean


5

Figured it out. Replace $this->getSubtotal() with $this->getQuote()->getGrandTotal()


5

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 changes. Here is an example: require(['Magento_Customer/js/customer-data'], function (customerData) { var cart = customerData.get('cart'); var count = ...


5

You need to override magento2\vendor\magento\module-checkout\CustomerData\Cart.php Find getRecentItems() function replace if (!isset($products[$productId])) { continue; } with if (!isset($products[$productId])) { $items[] = $this->itemPoolInterface->getItemData($item); continue; } Please let me know above code not work.


5

This above code will works on the page load, but will not work with magento2 ajax add to cart as it uses Knockout JS now. For that you should use - Override the magento class "\Magento\Checkout\CustomerData\Cart" in your module and extend method "getSectionData" public function getSectionData() { $objectManager = \Magento\Framework\App\...


Only top voted, non community-wiki answers of a minimum length are eligible