yireo / Yireo_GoogleTagManager2

Open Software License 3.0
146 stars 75 forks source link

Compatibility with Braintree #196

Closed dchudycreatuity closed 4 months ago

dchudycreatuity commented 1 year ago

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

jissereitsma commented 1 year ago

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

dchudycreatuity commented 1 year ago

I upgraded package to 3.6.4 and error still occurs

jissereitsma commented 11 months ago

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.

jissereitsma commented 11 months ago

This could potentially now be fixed: https://github.com/yireo/Yireo_GoogleTagManager2/commit/d87b3436d1efd7ef26fb39caa78bcf55e1f213b7

jissereitsma commented 4 months ago

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