- Issue created by @Rory Downes
When running this module with commerce_stripe, I found that the purchase event was not triggering.
Set up commerce to run with commerce_stripe so that payment is via stripe.
Take an order through the checkout and complete the stripe payment page.
Expected outcome: A purchase event is triggered and added to the dataLayer.
Actual outcome: The purchase event was not added to the dataLayer
The purchase event is triggered currently by and event responding to 'commerce_orders.place.post_transition'. In this case this event does not get triggered if the Stripe webhook calls onNotify first. I presume it will happen with other similar gateways.
I propose changing it to be triggered by KernalEvents::REQUEST. The issue is to prevent it getting resent if the completion page is refreshed. So I have added a session variable where the name includes the order ID to ensure it does not fire twice.
I supply a patch for consideration.
Review this patch and this concern to see if it is the correct approach or if it will cause other issues in other scenarios.
None.
None.
None.
Active
Code