Display total price and total items in minicart The 2019 Stack Overflow Developer Survey Results Are InMinicart in header is cached by FPCmini cart not showing itemsHow to display price times quantity in minicartIs it possible to add the rwd minicart to my own custom theme, and if so how could I do itrender minicart in custom layout - Magento 2Magento 2 minicartMagento 2 Minicart - Display line item subtotal rather than unit priceMagento 2: Show total items count in Knockout templateUpdate quantity in minicartMini cart content not rendering properly in Magento 2?
Lethal sonic weapons
How to manage monthly salary
Is there a name of the flying bionic bird?
Inline version of a function returns different value then non-inline version
Output the Arecibo Message
Springs with some finite mass
How come people say “Would of”?
Why could you hear an Amstrad CPC working?
Why Did Howard Stark Use All The Vibranium They Had On A Prototype Shield?
Understanding the implication of what "well-defined" means for the operation in quotient group
Are USB sockets on wall outlets live all the time, even when the switch is off?
Confusion about non-derivable continuous functions
Inversion Puzzle
"What time...?" or "At what time...?" - what is more grammatically correct?
Which Sci-Fi work first showed weapon of galactic-scale mass destruction?
Why is the maximum length of openwrt’s root password 8 characters?
Access elements in std::string where positon of string is greater than its size
How to change the limits of integration
Time travel alters history but people keep saying nothing's changed
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Why is Grand Jury testimony secret?
Is domain driven design an anti-SQL pattern?
Where to refill my bottle in India?
Where does the "burst of radiance" from Holy Weapon originate?
Display total price and total items in minicart
The 2019 Stack Overflow Developer Survey Results Are InMinicart in header is cached by FPCmini cart not showing itemsHow to display price times quantity in minicartIs it possible to add the rwd minicart to my own custom theme, and if so how could I do itrender minicart in custom layout - Magento 2Magento 2 minicartMagento 2 Minicart - Display line item subtotal rather than unit priceMagento 2: Show total items count in Knockout templateUpdate quantity in minicartMini cart content not rendering properly in Magento 2?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have installed magento 2.0.7 and overide the template minicart.phtml to my custom theme. I want to show total price and total items in the header minicart like the below image
magento2 mini-cart
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have installed magento 2.0.7 and overide the template minicart.phtml to my custom theme. I want to show total price and total items in the header minicart like the below image
magento2 mini-cart
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want$00 - 0 item
to be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you
– Arun Karnawat
Jul 28 '16 at 8:20
add a comment |
I have installed magento 2.0.7 and overide the template minicart.phtml to my custom theme. I want to show total price and total items in the header minicart like the below image
magento2 mini-cart
I have installed magento 2.0.7 and overide the template minicart.phtml to my custom theme. I want to show total price and total items in the header minicart like the below image
magento2 mini-cart
magento2 mini-cart
edited Jun 6 '16 at 10:44
Asha
asked Jun 6 '16 at 10:37
AshaAsha
3422522
3422522
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want$00 - 0 item
to be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you
– Arun Karnawat
Jul 28 '16 at 8:20
add a comment |
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want$00 - 0 item
to be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you
– Arun Karnawat
Jul 28 '16 at 8:20
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want
$00 - 0 item
to be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you– Arun Karnawat
Jul 28 '16 at 8:20
thank you, I have figured it out, but if you can, I want
$00 - 0 item
to be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you– Arun Karnawat
Jul 28 '16 at 8:20
add a comment |
4 Answers
4
active
oldest
votes
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
add a comment |
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
add a comment |
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f119512%2fdisplay-total-price-and-total-items-in-minicart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
add a comment |
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
add a comment |
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
answered Jun 6 '16 at 11:13
LM_FieldingLM_Fielding
7281437
7281437
add a comment |
add a comment |
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
answered Jul 28 '16 at 7:09
AshaAsha
3422522
3422522
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
add a comment |
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
add a comment |
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
answered Dec 5 '16 at 10:05
Abhinav SinghAbhinav Singh
2,115612
2,115612
add a comment |
add a comment |
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
add a comment |
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
add a comment |
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
answered Jun 22 '18 at 11:01
Nadeem0035Nadeem0035
593411
593411
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f119512%2fdisplay-total-price-and-total-items-in-minicart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want
$00 - 0 item
to be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you– Arun Karnawat
Jul 28 '16 at 8:20