Magento2: Cart SubTotal Error

Created on 24 Jan 2016  路  27Comments  路  Source: magento/magento2

When Display Sub-total = Including Tax per the below

screen shot 2016-01-24 at 10 01 34 pm

The mini-cart sub-total is not show:

screen shot 2016-01-24 at 10 03 22 pm

Error shown in the console:

ReferenceError: Unable to process binding "if: function (){return displaySubtotal() }"
Message: Unable to process binding "if: function (){return !display_cart_subtotal_excl_tax && display_subtotal_incl_tax }"
Message: Can't find variable: display_subtotal_icl_tax

I believe this is a bug. Same symptom on 2.0.1 & 2.0.0 / clean/fresh installs

Ready for Work needs update bug report

Most helpful comment

I solved this issue thanks to friizu.

I added 'display_subtotal_incl_tax' => (int)$this->taxConfig->displayCartSubtotalInclTax()
in /Tax/CustomerData/CheckoutTotalsJsLayoutDataProvider.php.

The function getTotalsConfig() on rule 61 looks like this now:

protected function getTotalsConfig() { return [ 'display_subtotal_incl_tax' => (int)$this->taxConfig->displayCartSubtotalInclTax(), 'display_cart_subtotal_incl_tax' => (int)$this->taxConfig->displayCartSubtotalInclTax(), 'display_cart_subtotal_excl_tax' => (int)$this->taxConfig->displayCartSubtotalExclTax(), ]; }

All 27 comments

@rkhoury82 Thank you for reporting this issue. Currently we were unable to reproduce it with the provided information. Could you please provide more detailed steps to reproduce, e. g. settings you have changed, product type you are using?
Thanks.

Hi @ishakhsuvarov thanks for looking ! I have attached the other tax settings. In Australia all prices must be displayed with taxes, hence why I have everything displayed with tax including.

This was a clean install, i just changed these tax settings attached and created 1 configurable product with some variations.

screen shot 2016-01-25 at 9 38 02 pm
screen shot 2016-01-25 at 9 38 09 pm
screen shot 2016-01-25 at 9 38 16 pm

screen shot 2016-01-25 at 9 45 57 pm
screen shot 2016-01-25 at 9 46 11 pm

I can always dump the database and send across if that helps?

I can confirm with a js error

Uncaught ReferenceError: Unable to process binding "if: function (){return displaySubtotal() }"
Message: Unable to process binding "if: function (){return !display_cart_subtotal_excl_tax && display_subtotal_incl_tax }"
Message: display_subtotal_incl_tax is not defined

Another problem with include tax when I'm in checkout

weee.extend.getRowWeeeTaxInclTax @ row_incl_tax.js:35weee.extend.getRowDisplayPriceInclTax @ row_incl_tax.js:29$element.text @ VM15638:3ko.bindingHandlers.text.update @ knockout.js:4260ko.dependentObservable.disposeWhenNodeIsRemoved @ knockout.js:3004evaluateImmediate @ knockout.js:1737ko.computed.ko.dependentObservable @ knockout.js:1946(anonymous function) @ knockout.js:3002ko.utils.arrayForEach @ knockout.js:151applyBindingsToNodeInternal @ knockout.js:2974applyBindingsToNodeAndDescendantsInternal @ knockout.js:2854applyBindingsToDescendantsInternal @ knockout.js:2836applyBindingsToNodeAndDescendantsInternal @ knockout.js:2863applyBindingsToDescendantsInternal @ knockout.js:2836ko.applyBindingsToDescendants @ knockout.js:3052ko.computed.disposeWhenNodeIsRemoved @ knockout.js:4004evaluateImmediate @ knockout.js:1737ko.computed.ko.dependentObservable @ knockout.js:1946ko.bindingHandlers.(anonymous function).init @ knockout.js:3988(anonymous function) @ knockout.js:2989ko.computedContext.ko.dependencyDetection.ignore @ knockout.js:1249(anonymous function) @ knockout.js:2988ko.utils.arrayForEach @ knockout.js:151applyBindingsToNodeInternal @ knockout.js:2974applyBindingsToNodeAndDescendantsInternal @ knockout.js:2854ko.applyBindings @ knockout.js:3065_super @ wrapper.js:73wrapper.extend.applyBindings @ bound-nodes.js:95(anonymous function) @ wrapper.js:78(anonymous function) @ knockout.js:4862invokeForEachNodeInContinuousRange @ knockout.js:4813activateBindingsOnContinuousNodeArray @ knockout.js:4860executeTemplate @ knockout.js:4908ko.dependentObservable.disposeWhen @ knockout.js:4950evaluateImmediate @ knockout.js:1737evaluatePossiblyAsync @ knockout.js:1677ko_subscribable_fn.notifySubscribers @ knockout.js:1103observable.valueHasMutated @ knockout.js:1300observable @ knockout.js:1285(anonymous function) @ engine.js:53fire @ jquery.js:3099self.fireWith @ jquery.js:3211deferred.(anonymous function) @ jquery.js:3301fire @ jquery.js:3099self.fireWith @ jquery.js:3211(anonymous function) @ jquery.js:3263fire @ jquery.js:3099self.fireWith @ jquery.js:3211deferred.(anonymous function) @ jquery.js:3301(anonymous function) @ loader.js:58fire @ jquery.js:3099self.fireWith @ jquery.js:3211deferred.(anonymous function) @ jquery.js:3301(anonymous function) @ loader.js:44context.execCb @ require.js:1650Module.check @ require.js:866(anonymous function) @ require.js:1113(anonymous function) @ require.js:132(anonymous function) @ require.js:1156each @ require.js:57Module.emit @ require.js:1155Module.check @ require.js:917Module.enable @ require.js:1143Module.init @ require.js:774(anonymous function) @ require.js:991(anonymous function) @ require.js:132(anonymous function) @ text.js:149xhr.onload @ text.js:112
knockout.js:3012 Uncaught SyntaxError: Unable to process binding "foreach: function (){return $parent.elems() }"
Message: Unable to process binding "template: function (){return getTemplate() }"
Message: Unable to process binding "foreach: function (){return getRegion('after_details') }"
Message: Unable to process binding "template: function (){return getTemplate() }"
Message: Unable to process binding "if: function (){return isPriceInclTaxDisplayed() && getRegion('row_incl_tax') }"
Message: Unable to process binding "foreach: function (){return getRegion('row_incl_tax') }"
Message: Unable to process binding "template: function (){return getTemplate() }"
Message: Unable to process binding "ifnot: function (){return (isDisplayPriceWithWeeeDetails($parents[2])) }"
Message: Unable to process binding "text: function (){return getFormattedPrice(getRowDisplayPriceInclTax($parents[2])) }"
Message: Unexpected token a

@rkhoury82 We have created an internal ticket MAGETWO-48459 to fix the problem. Thank you for reporting

Awesome, thanks for your help

I'm experiencing the same issue , any updates on this ?

Workaround until fix is released: Override the vendor/magento/module-tax/view/frontend/web/template/checkout/minicart/subtotal/totals.html template and replace display_subtotal_incl_tax with display_cart_subtotal_incl_tax.

Closing this ticket, as the fix seems to be delivered with the commit 5590fd.
Please reopen if you have any additional questions related to this.

HI
I just downloaded 2.0.4 zip and despite the commit being from October, the fix is not there.

I'm using 2.0.4 and I also see the problem.

@ozgeekmum @Krapulat Thanks for update. Reopening the ticket for additional investigation on our side.

Hei, I also have same problem, i got it work when i added back line what was removed 5590fd

return [
'display_subtotal_incl_tax' => (int)$this->taxConfig->displayCartSubtotalInclTax(),

/Tax/CustomerData/CheckoutTotalsJsLayoutDataProvider.php

using magento 2.0.4

Think there is a bit mess cause sometimes u need 'display_subtotal_incl_tax' and sometimes 'display_cart_subtotal_incl_tax' as general they should be same value.

Hello,
any news about that bug? We are also using Magento 2.0.4
and get that error...:(

2.0.5 is also affected.

I get this error when I enable configuration Display subtotal including taxes in tax configuration ... Version: 2.0.5.

I can confirm the same bug on Magento 2.0.6. Pretty much makes the cart broken since it never hides it's spinner

Hello - this is still here in 2.0.7 and am unable to checkout too.

I solved this issue thanks to friizu.

I added 'display_subtotal_incl_tax' => (int)$this->taxConfig->displayCartSubtotalInclTax()
in /Tax/CustomerData/CheckoutTotalsJsLayoutDataProvider.php.

The function getTotalsConfig() on rule 61 looks like this now:

protected function getTotalsConfig() { return [ 'display_subtotal_incl_tax' => (int)$this->taxConfig->displayCartSubtotalInclTax(), 'display_cart_subtotal_incl_tax' => (int)$this->taxConfig->displayCartSubtotalInclTax(), 'display_cart_subtotal_excl_tax' => (int)$this->taxConfig->displayCartSubtotalExclTax(), ]; }

Hi,

Same problem at Magento 2.0.7 over here. Let us know when it is finished in the core.

@JamboMedia
The solution i posted before is for Magento 2.0.7 aswell.

@tristannederhoff
Yes it works, but we need this to be fixed in core, so its included next updates etc ...

@friizu @JamboMedia My apologies. I didn't the second part of the sentence and was to quick with reacting.

Any solution for this?
I am facing same issue in 2.0.7.

Hello, @rkhoury82, @quienti, @chamalC, @AndreasSundstrom, @ozgeekmum, @Krapulat, @friizu, @klarlichter, @heldchen, @peec, @kanduvisla,
@vektor-dev, @tristannederhoff, @JamboMedia, @arvind07

Initial problem described in the second post by @rkhoury82 was fixed and contributed with latest release 2.1. We verified it in several conditions and workarounds and it cannot be reproduce for 2.1+.

  • Cart Subtotals is presented in mini cart for configurable product with described tax configuration
  • There are no JS errors related to subtotal(tax) during checkout flow.

Probably there are some other steps or preconditions that was missed in the thread.
So could You pls re-check it? Is the problem still presented in Your case(s)?

@sdzhepa Apparently, work fine on Magento 2.1.0, thanks !

The issue has been fixed in 2.1.0, and will be available in 2.0.x in one of the next patches.

Was this page helpful?
0 / 5 - 0 ratings