nystudio107 / craft-instantanalytics

DEPRECATED: Instant Analytics brings full Google Analytics support to your Twig templates and automatic Craft Commerce integration with Google Enhanced Ecommerce.
https://nystudio107.com/
Other
20 stars 9 forks source link

What should get passed to addCommerceProductDetailView() #75

Closed mediabeastnz closed 1 year ago

mediabeastnz commented 1 year ago

Question

We've been using the V3 of this plugin and upon upgrading to V4 we get a bunch of warnings because productData['sku'] isn't defined.

What information can we pass this twig function so that it looks for a sku (they do exist on the products variants)?

Additional context

Use to work fine on version 3 or at least no warning appeared.

khalwat commented 1 year ago

Can you post the exact error message you're seeing? I've looked through the code, and it gets the sku from the productVariant:

            $productData = [
                'sku' => $productVariant->sku,
                'name' => $name,
                'price' => number_format($productVariant->price, 2, '.', ''),
                'category' => $category,
            ];
Romanavr commented 1 year ago

Hey @khalwat I run into the same issue after upgrade to 4.x craft & craft commerce. I did some digging and found a bottleneck. Could you check the PR https://github.com/nystudio107/craft-instantanalytics/pull/77 ?

Thanks

karensg commented 1 year ago

Hey @khalwat Could you check the PR please? What do you think?

khalwat commented 1 year ago

Looks good, I will merge it in, thanks!

khalwat commented 1 year ago

Closed via https://github.com/nystudio107/craft-instantanalytics/pull/77