1

I want to change the Magento_Checkout/web/template/summary/shipping.html file and add a specific line when the subtotal is below a specific value.

How can I achieve this? I already tried this, but that does not work:

        <!-- ko if: totals().subtotalAmount < 29.95 -->
        <span class="shipping-cost"><!-- ko i18n: '$ 5,95' --><!-- /ko --></span>
        <!-- /ko -->
        <!-- ko if: totals().subtotalAmount > 29.95 -->
        <span class="shipping-free"><!-- ko i18n: 'Free' --><!-- /ko --></span>
        <!-- /ko -->
2

You should do that.

        <!-- ko if: totals()['subtotal'] < 29.95 -->
        <span class="shipping-cost"><!-- ko i18n: '$ 5,95' --><!-- /ko --></span>
        <!-- /ko -->
        <!-- ko if: totals()['subtotal'] > 29.95 -->
        <span class="shipping-free"><!-- ko i18n: 'Free' --><!-- /ko --></span>
        <!-- /ko -->
  • Thanks a lot! That was the trick – JGeer Dec 8 '19 at 22:25
  • you are welcome. maybe, if you want to show other variables, you can try this. <div data-bind="text: ko.toJSON(totals())"></div> – yvzyldrm Dec 8 '19 at 22:35

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.