yireo/Yireo_GoogleTagManager2

Necessary To Load Products In Cart / Checkout?

Closed this issue · 5 comments

Still / again doing some profiling... I saw that in the cart and checkout, the extension fully loads all products from all quote items, which takes quite some time:

image

image

Do we really need to fully load the product in the cart / checkout?

By the way, mapByProduct is so expensive due to the loading of all categories:

image

@jissereitsma, do you have any thoughts on this? Thanks!

Good point. My thoughts? This should prevented. However, it requires some magic to do so. With the products, I already created now a draft for this: Introducing a new class that collects all product SKUs first, then fetches data for all SKUs at once, and then reuses them. f89fc8b

Perhaps this can also be used for categories. I'm on a holiday soon, so can only pick this up in 2 weeks time.

Ran into this same thing while profiling for a client. The GTM data loading and rendering (products and categories) takes 30 seconds for us on a 300-item cart, ~90ms/product.

In our case we're not even sending any custom product attrs, so the loading is unnecessary, all product data is already on the cart item product.

Thanks @rhoerr for chiming in. The product load should be a lot less now already, but I'll still work on the same thing with categories. And indeed the "hydration" seems a bit much if it is not needed after all - I'll also check for that to see if that can be made more flexible.

The previous fix already brought the load down to a minimum, but with the new release 3.7.6 I also refactored the categories part, so far less queries are needed.

As of yet, I'm closing this issue, but let me know if this is still bugging.