Fix: grouped events#30
Open
ahuininga-orisha wants to merge 21 commits into
Open
Conversation
added 2 commits
April 30, 2026 11:59
- Declare magento/module-configurable-product in composer.json require so PHPStan can resolve Configurable and ConfigurableResource types - Add use stdClass import; remove inline fully-qualified reference - Extract AddToCartExposed and QuoteItemWithProductId to separate files to satisfy PSR1 one-class-per-file rule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix/grouped-events — Grouped export product key resolution for events
Summary
simpleId-parentIdformat. All events (add to cart, add to wishlist, product view, purchase) were sending plain product IDs, causing incorrect tracking for configurable products.tweakwise/magento2-tweakwise-exportto^7.8.3to support the updatedgetTweakwiseIdsignature with an optional$groupCodeparameter.Core logic
resolveGroupedExportProductKey()toHelper/Data.php— handles configurable, simple-with-parent, and standalone simple products, returning the correctsimpleId-parentIdkey when grouped export is on.getTweakwiseId()with an optional$groupCodeparameter passed through to the export helper.Add to Cart
checkout_cart_add_product_complete→checkout_cart_product_add_afterto get access to thequote_itemfor resolving simple/parent IDs.AddToCartevent now receives theQuote\Itemand resolves the grouped key viaqty_options.tweakwise_event_handledrequest param to widget-triggered add-to-cart requests (Luma & Hyvä) to prevent the observer from double-firing.Add to Wishlist
AddToWishlistnow callsresolveGroupedExportProductKey()using the product's type ID.tweakwise_event_handledguard added to the wishlist observer.Product View
resolveGroupedExportProductKey()instead of the plain product ID.Purchase / Order
ViewModel/Event.phpnow maps order items tosimpleId-parentIdformat when grouped export is enabled, pairing child and parent product IDs from order items.DI / Plugin fixes
virtualTypeplugin declarations for Cart and Wishlist customer data sections to concrete classes (AddEventDataToCartSection,AddEventDataToWishlistSection) to fix a DI resolution issue.di.xml.How to test
Prerequisites
Stores > Configuration > Tweakwise > Export > Grouped export.1. Add to Cart — configurable product
productKeyis insimpleId-parentIdformat (e.g.10000500001-10000400001), not a plain ID.2. Add to Wishlist — configurable product
addtowishlistevent payload has aproductKeyinsimpleId-parentIdformat.3. Product View event
productViewevent fires with aproductKeyinsimpleId-parentIdformat.4. Purchase event
purchaseevent payload lists product keys insimpleId-parentIdformat.5. No double-firing (Tweakwise widget add-to-cart)
addtocartevent fires exactly once. The tweakwise js should trigger the event from the category/search lister pages. Not the observer.6. Grouped export OFF
-parentIdsuffix.