yireo/Yireo_GoogleTagManager2

Compatibility with Braintree

Closed this issue · 5 comments

I use Yireo_GoogleTagManager2 with Braintree payment, GPay, ApplePay, PayPal and after successfull payment we got an error message No such entity with cartId = %ID% is coused by calculating totals in \Magento\Checkout\Model\TotalsInformationManagement::calculate, order is placed properly but error is occured

I found that is coused by cart reload in vendor/yireo/magento2-googletagmanager2/view/frontend/web/js/checkout/payment-validator/reload-customer-data.js line 9 customerData.reload(['cart'], true); cart is no longer active so totals can't be calculated

magento/product-enterprise-edition 2.4.6-p2
paypal/module-braintree 4.5.0-p1
yireo/magento2-googletagmanager2 3.5.8

Could you first upgrade to 3.6.4 and see if that fixes things?

I upgraded package to 3.6.4 and error still occurs

Sorry for the delay. I have tested this out myself and unfortunately, after 3 tests I am unable to reproduce this myself. It is also weird that it should occur in the first place: The customerData.reload(['cart'], true) statement is indeed part of the script checkout/payment-validator/reload-customer-data.js of this extension, which is actually called from another script checkout/payment-validator/register.js. But only in the checkout (handle checkout_index_index) this register.js is added to the JS stack of the checkout. And there it is part of the payment validators, where a payment shouldn't destroy the current quote (cart) because that should only happen on the success page.

Anyway, I can see that this could be an issue. And the reason why this call is there, is because the GoogleTagManager uses this as a transport of data. But instead of using the customerData section of cart, it makes more sense to checkout instead. I'll add a fix for this.

This could potentially now be fixed: d87b343

I'm closing this due to inactivity. If this is still an issue, feel free to reopen.