0

I'm trying to show subtotal in minicart block. I've overridden minicart.phtml in my theme and added the below code:

<span data-bind="html: getCartParam('subtotal_excl_tax'), blockLoader: isLoading"></span>

Its showing subtotal on page refresh. But when I add product in the cart the amount doesn't load by Ajax.

Can anyone help me in this?

Thanks in advance.

  • subtotal is already default show in minicart. – Rakesh Jesadiya Oct 17 '16 at 7:08
  • @Rakesh thanks for your reply. please see this prntscr.com/cv9sqp – Deeps Oct 17 '16 at 7:15
  • Show your code file – Rakesh Jesadiya Oct 17 '16 at 7:18
  • <span class="cart-price"> <?php /* @escapeNotVerified */ echo __('Mijn artikelen'); ?> <span data-bind="html: getCartParam('subtotal_excl_tax'), blockLoader: isLoading"></span> </span> – Deeps Oct 17 '16 at 7:27
  • I've added above code in overridden minicart.phtml. Its loading subtotal after page refresh. I wan't it should work like quantity. Means when I add product to cart it should be load via Ajax. – Deeps Oct 17 '16 at 7:28
3

Subtotal along with counter

<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 class="counter-number" data-bind="html: getCartParam('subtotal')"></span>
</span>
  • Thank you so much. – Pratik Mehta Apr 30 '19 at 12:37
  • Could you please help me? I have displayed cart item custom but when I remove item not able to remove from minicart. – Pratik Mehta Apr 30 '19 at 12:37
0

Please use below code

<span class="counter qty subtotal empty"
              data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading">
            <span class="counter-number" data-bind="html: getCartParam('subtotal')"></span>
        </span>

Hope this helps;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.