trackProductView doesn't respect selected variation

Created on 29 March 2023, over 1 year ago

Problem/Motivation

When a different variation than the default is selected via add to cart form the `?v={id}` is appended to the url where the {id} is the Variation ID for the currently selected variation. This way each product variation has an unique canonical URL. CommerceEventsSubscriber::trackProductView doesn't respect selected variation and always loads the default variation for the product which results in providing different data about the viewed product for tracking purposes than the product (variation) that is actually viewed.

Steps to reproduce

- create product with 2 variations
- switch variation via add to cart form
- observe the url has changed
- reload page
- observe the variation used in CommerceEventsSubscriber::trackProductView is different than the variation shown on the screen

Proposed resolution

Respect the selected variation in CommerceEventsSubscriber::trackProductView

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Miscellaneous

Created by

🇳🇴Norway zaporylie

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024