Skip to content

Instantly share code, notes, and snippets.

View wanze's full-sized avatar
👨‍💻

Stefan Wanzenried wanze

👨‍💻
View GitHub Profile
@wanze
wanze / AlterShippingData.php
Last active March 8, 2019 21:06
commerce_google_tag_manager: Example of an AlterEventData event subscriber
<?php
use Drupal\commerce_google_tag_manager\Event\AlterEventDataEvent;
class AlterShippingData implements EventSubscriberInterface {
public static function getSubscribedEvents() {
return [
'commerce_gtm_enhanced_ecommerce.alter_event_data' => 'addShipping'
];
@wanze
wanze / CheckoutOptionSubscriber.php
Created February 1, 2019 14:49
commerce_google_tag_manager: Example of a CheckoutOption event subscriber
use Drupal\commerce_google_tag_manager\Event\TrackCheckoutStepEvent;
<?php
class CheckoutOptionSubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents() {
return [
'commerce_google_tag_manager.track_checkout_step' => 'trackUser'
];
@wanze
wanze / AlterProductSubscriber.php
Last active March 8, 2019 21:06
commerce_google_tag_manager: Example implementation of an AlterProduct event subscriber
<?php
use Drupal\commerce_google_tag_manager\Event\AlterProductEvent;
class AlterProductSubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents() {
return [
'commerce_gtm_enhanced_ecommerce.alter_product' => 'alterProduct'
];