Reputation: 21
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 -->
Upvotes: 0
Views: 10