cancel
Showing results for 
Search instead for 
Did you mean: 

Code location for the functions for summary totals

SOLVED

Code location for the functions for summary totals

Hello,

Where exactly in the code are those functions which get the totals (subtotal, shipping, tax and order total) from the checkout page, summary section?

I found the .html files such as grand-total.html, with the following code, but where is the function exactly? From where it tries to get the value (getValue())?

<!-- ko if: isDisplayed() -->
<tr class="grand totals">
<td class="mark" scope="row">
<strong data-bind="i18n: title"></strong>
</td>
<td class="amount" data-bind="attr: {'data-th': $t(title)}">
<strong><span class="price" data-bind="text: getValue()"></span></strong>
<!-- ko foreach: elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</td>
</tr>
<!-- /ko -->

I want to format the price for all those prices: remove the comma or point separator and add the decimals between a <sup> tag.

Thanks.
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Code location for the functions for summary totals

You can get the function of getValue() from JS file.

Your location would be from Checkout Module,

 

vendor/magento/module-checkout/view/frontend/web/js/view/summary/grand-total.js

getValue: function () {
            return this.getFormattedPrice(this.getPureValue());
        }
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

2 REPLIES 2

Re: Code location for the functions for summary totals

You can get the function of getValue() from JS file.

Your location would be from Checkout Module,

 

vendor/magento/module-checkout/view/frontend/web/js/view/summary/grand-total.js

getValue: function () {
            return this.getFormattedPrice(this.getPureValue());
        }
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Code location for the functions for summary totals

Thanks! It's working. Also, during checkout I had to run through different modules to take care of all prices, such as Magento_Weee and Magento_Tax.