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

Undefined array key "sku" #78

Closed sarahschuetz closed 1 year ago

sarahschuetz commented 1 year ago

Describe the bug

When I use {% do instantAnalytics.addCommerceProductDetailView(product) %} on the product detail page I get the following error after update from Craft 3 to Craft 4: Undefined array key "sku"

product is an object of craft\commerce\elements\Product not craft\commerce\elements\Variant, so I guess it must be product['defaultSku'] instead of product['sku'] in case a product is passed in.

Versions

khalwat commented 1 year ago

This should be fixed in 4.0.3 -> https://github.com/nystudio107/craft-instantanalytics/releases/tag/4.0.3