Magento – totals not showing on shipping step in opc-summary-block

checkoutknockoutjsmagento-2.1magento2totals

Sometimes I get the totals block saying totals can't yet be calculated.
On very few occasions I get the same totals block as on billing step.
But most of the time the totals block is just empty and not even loaded.
I just have the list of ordered items.

Has anyone looked into the totals block and can tell me where loading happens and where the logic resides that handles wether or not the block is loaded?
I'm searching my ass off again and can't find anything that would prevent it's loading -.-

THANKS!

Best Answer

The "problem" is located at

app/code/Magento/Checkout/view/frontend/web/js/view/summary/abstract-total.js

Here you will find:

isFullMode: function() {
    if (!this.getTotals()) {
        return false;
    }
    return stepNavigator.isProcessed('shipping');
}

isProcessed will return false as long as you have not passed the shipping step. So the totals won't show up at all in shipping step. I think something must overwrite that "sometimes" as sometimes part of it is showing up. Just change that function to:

isFullMode: function() {
    return true;
}

and the totals will always come up. I have not thoroughly tested this!

P.S.: To overwrite you can use several ways. Like just placing the original abstract-total.js in the same folder structure as in the magento module in your own module. Or you can extend that component, or ...