yireo/Yireo_GoogleTagManager2

CartItems always returns empty

joachimVT opened this issue · 5 comments

Preconditions and environment

Magento version = 2.4.3-p3
Module Tag manager version: 3.0.10 (latest)

Hi

The view_cart event always seems to return empty cart items:

{event: 'view_cart', ecommerce: {…}}
ecommerce:
items: []
event: "view_cart"

I think it has something to do with: Magento\Quote\Api\Data\CartInterface in Yireo\GoogleTagManager2\DataLayer\Tag\Cart\CartItems.

$this->cart->getItems(); always returns null .

If I use Magento\Checkout\Model\Cart $cartModel
$this->cartModel->getQuote()->getItems(); I get the expected results with 3 items.

Ps thank you for the awesome updated with GA4 and Hyva support!

I have the same issue on the same Magento version with Hyva as frontend.

I am working on a fix. Will create a PR today or tomorrow.

Thank you! Keep up the good work!

This should now be fixed in version 3.0.12.

Thank you @jissereitsma , I think this issue can be closed.