0

I tried to add multiple custom fees in checkout page, i tried to fetch labels of fees as array and need to show on by one, but its fail in KnockoutJS binding, below is my fee.html and fee.js file code

fee.js::

function (ko, Component, quote, priceUtils, totals) {
    'use strict';
     var feeLabels = window.checkoutConfig.fee_labels || [];
     var custom_fee_amount = window.checkoutConfig.custom_fee_amount;

    return Component.extend({
        feeLabels: ko.observableArray(feeLabels),
        getFormattedPrice: ko.observable(priceUtils.formatPrice(custom_fee_amount, quote.getPriceFormat())),
    ...
    })

And my fee.html:

<!-- ko foreach: feeLabels -->
        <tr class="totals fee excl">
            <th class="mark" colspan="1" scope="row" data-bind="text: $data + ' ' + $parent.getExFeeLabel()"></th>
              <td class="amount">
                 <span class="price" data-bind="text: $parent.getFormattedPrice()"></span>
              </td>
       </tr>
    <!-- /ko -->

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.