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.

6
  • subtotal is already default show in minicart. Commented Oct 17, 2016 at 7:08
  • @Rakesh thanks for your reply. please see this prntscr.com/cv9sqp
    – Deeps
    Commented Oct 17, 2016 at 7:15
  • Show your code file Commented Oct 17, 2016 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
    Commented Oct 17, 2016 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
    Commented Oct 17, 2016 at 7:28

2 Answers 2

4

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>
2
  • Thank you so much. Commented Apr 30, 2019 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. Commented Apr 30, 2019 at 12:37
1

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 and acknowledge you have read our privacy policy.

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