1

I have one requirement where client want to exclude the tax amount from the Total cart Amount. So i am doing this by modifying my Sitecore base theme js i.e. Cart-model.js.

Currently tax-Total is coming from this piece of code - self.taxTotal = ko.observable(data != null ? data.TaxTotal : 0);

And Total is coming from this -

self.total = ko.observable(data != null ? data.Total : 0);

I tried to get the amount without tax by given code -

self.TotalWithoutTax = ko.computed(function () {
        var result = self.total;
        ko.utils.arrayForEach(self.taxTotal(), function (item) {
            result = result - item.taxTotal();
        });
        console.log(result);
        return result;        
    });

But i am unable achieve my requirement. Please help me out if anybody knows what to do.

Thanks

2
  • what if you try var result = self.total - self.taxTotal; – Gaurav Agarwal Mar 5 at 16:17
  • @GauravAgarwal it will return NAN. – Akash Mishra Mar 5 at 16:24

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.