I have overriten the content.html minicart template in my theme, currently the code looks like this:

<!-- ko if: cart().summary_count -->
 <div class="detailArea">
    <ol id="mini-cart" class="minicart-items" data-bind="foreach: { data: cart().items, as: 'item' }">
        <!-- ko foreach: $parent.getRegion($parent.getItemRenderer(item.product_type)) -->
        <!-- ko if: $parentContext.$index() === 0 -->
            <!-- ko template: {name: getTemplate(), data: item, afterRender: function() {$parents[1].initSidebar()}} --><!-- /ko -->
            <!-- /ko -->
        <!-- /ko -->

        <p class="msgArea">他に<span data-bind="html: cart().items.length - 1"></span>点の商品があります</p>
        <div class="infoArea">
          <div class="info_item __quantity">
            <p class="quantity_heading">商品点数</p>
            <p class="quantity_item"><span data-bind="html: cart().summary_count"></span>点</p>
          <div class="info_item __itemTotal">
            <p class="itemTotal_heading">商品合計</p>
            <p class="itemTotal_item"><span data-bind="html: cart().subtotal"></span>(税込)</p>
          <div class="info_item __postage is-login">
            <p class="postage_heading">送料</p>
            <p class="postage_item">¥<span data-bind="html: cart().delivery_fee"></span>(税込)</p>
          <p class="info_item __txt is-login">送料はご登録住所を元に計算</p>
          <div class="info_item is-login">
              <p class="postage_heading">手数料</p>
              <!--<p class="postage_item">¥<span data-bind="html: cart().delivery_fee"></span>(税込)</p>-->
          <div class="info_item __allTotal is-login">
            <p class="allTotal_heading">合計</p>
            <p class="allTotal_item"><span data-bind="html: cart().subtotal"></span>(税込)</p>

        <!-- /ko -->

<!-- ko if: cart().summary_count -->
    <!-- ko if: cart().possible_onepage_checkout -->
    <ul class="btnArea">
          <li class="btn __request __round"><a data-bind="attr: {href: shoppingCartUrl}" class="btn_item __next" >買い物かごを見る</a></li>
          <li class="btn __conversion __round"><a href="#" class="btn_item __next" id="top-cart-btn-checkout" >注文する</a></li>

    <!-- /ko -->
<!-- /ko -->

<!-- ko ifnot: cart().summary_count -->
    <strong class="subtitle empty" data-bind="visible: closeSidebar()">
         <p class="taC is-cartEmpty">買い物かごに商品はありません</p>
    <!-- ko if: cart().cart_empty_message -->
        <p class="taC is-cartEmpty">
            <!-- ko text: cart().cart_empty_message --><!-- /ko --></p>

        <div class="actions">
            <div class="secondary">
                <a class="action viewcart" data-bind="attr: {href: shoppingCartUrl}">
                    <span><!-- ko text: $t('View and edit cart') --><!-- /ko --></span>
    <!-- /ko -->
<!-- /ko -->

<div id="minicart-widgets" class="minicart-widgets">
    <!-- ko foreach: getRegion('promotion') -->
        <!-- ko template: getTemplate() --><!-- /ko -->
    <!-- /ko -->

Can anyone explain where I would find these functions:


And how would I go about adding my own function? Example: cart().total_after_charge_fee


| improve this question | | | | |
  • I think it is a file \Magento\Checkout\CustomerData\Cart and you should see the js module in Magento 2. I hope it will help you. – Abbas Feb 14 '17 at 3:28

Your Answer

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

Browse other questions tagged or ask your own question.