Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Under Analytics reports, it's currently associating "Product SKU" with the product ID and not the variation SKU. Which isn't very useful.
Proposed resolution
I suggest using the product variation SKU if it's available.
Comments
Comment #2
cbildstein CreditAttribution: cbildstein at Acro Commerce commentedPatch for using the variation SKU if it's available.
Comment #3
wengerkMany thanks for your contribution.
It seems the change break our tests (which is good - it means we cover the case).
May you update the tests strategy in the patch ?
Comment #4
wengerkComment #5
smccabe CreditAttribution: smccabe as a volunteer and at Acro Commerce commentedRe-roll
Comment #6
smccabe CreditAttribution: smccabe as a volunteer and at Acro Commerce commentedRe-roll against specifically against alpha2 as well, if anyone is using this patch currently.
Comment #7
cbildstein CreditAttribution: cbildstein at Acro Commerce commentedAlpha3 patch re-roll.
Comment #8
Aerzas CreditAttribution: Aerzas at Watch Dreamer SA for Watch Dreamer SA commentedHere is an update of the patch against the `8.x-2.x-dev` branch:
- Removed the condition as the `sku` is required for a product variation to be valid
- Updated unit, kernel and functional tests
Comment #9
agoradesign CreditAttribution: agoradesign commented+1 for this change!
The premium solution would make this behaviour configurable, making it easier to stay BC (however we're in beta version, so we don't have to worry too much about this). But one thing that would be nice: firing a dedicated Drupal/Symfony event for altering the ID key (for products and any other purchasable entity), if any custom solution is needed. Right now we could do this with AlterEventDataEvent, but this can be a little bit cumbersome, as we only have the GTM event data there without any context