From 9905f3db4d305ecf16ec6d78a8b3b5deb838dea1 Mon Sep 17 00:00:00 2001 From: Victor Kloeppel Date: Wed, 12 Nov 2025 14:03:14 +0100 Subject: [PATCH 1/3] changed config --- view/frontend/layout/hyva_checkout_index_index.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/frontend/layout/hyva_checkout_index_index.xml b/view/frontend/layout/hyva_checkout_index_index.xml index 285290cf..373b67cb 100644 --- a/view/frontend/layout/hyva_checkout_index_index.xml +++ b/view/frontend/layout/hyva_checkout_index_index.xml @@ -3,7 +3,7 @@ + ifconfig="GTM/settings/enabled"> Tagging\GTM\MageWire\Checkout Tagging\GTM\DataLayer\Event\BeginCheckout From 6321fd922d758b52053434f9ced5a0904acaf924 Mon Sep 17 00:00:00 2001 From: Victor Kloeppel Date: Wed, 12 Nov 2025 14:51:39 +0100 Subject: [PATCH 2/3] changes to checkout --- view/frontend/layout/hyva_checkout_index_index.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/view/frontend/layout/hyva_checkout_index_index.xml b/view/frontend/layout/hyva_checkout_index_index.xml index 373b67cb..74d9646f 100644 --- a/view/frontend/layout/hyva_checkout_index_index.xml +++ b/view/frontend/layout/hyva_checkout_index_index.xml @@ -1,9 +1,11 @@ - - + + Tagging\GTM\MageWire\Checkout Tagging\GTM\DataLayer\Event\BeginCheckout From 733c634a7a6123712b0383fb6fae22d1ce8dcf5f Mon Sep 17 00:00:00 2001 From: Victor Kloeppel Date: Wed, 12 Nov 2025 15:17:44 +0100 Subject: [PATCH 3/3] changed logic of boot secuence and begin checkout --- MageWire/Checkout.php | 15 +++++++++---- .../layout/hyva_checkout_index_index.xml | 4 ++-- .../templates/hyva_checkout/data-layer.phtml | 22 ++++++------------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/MageWire/Checkout.php b/MageWire/Checkout.php index 84ddc8b7..b5a84d7c 100644 --- a/MageWire/Checkout.php +++ b/MageWire/Checkout.php @@ -10,10 +10,6 @@ class Checkout extends Component { - protected $listeners = [ - 'shipping_method_selected' => 'triggerShippingMethod', - 'payment_method_selected' => 'triggerPaymentMethod', - ]; private CheckoutSession $checkoutSession; private BeginCheckout $beginCheckout; private AddShippingInfo $addShippingInfo; @@ -31,6 +27,17 @@ public function __construct( $this->addPaymentInfo = $addPaymentInfo; } + public function boot(): void + { + $parent = get_parent_class($this); + if ($parent && method_exists($parent, 'boot')) { + parent::boot(); + } + + $this->listeners['shipping_method_selected'] = 'triggerShippingMethod'; + $this->listeners['payment_method_selected'] = 'triggerPaymentMethod'; + } + public function triggerBeginCheckout() { $this->dispatchBrowserEvent('ga:trigger-event', $this->beginCheckout->get()); diff --git a/view/frontend/layout/hyva_checkout_index_index.xml b/view/frontend/layout/hyva_checkout_index_index.xml index 74d9646f..c976b8da 100644 --- a/view/frontend/layout/hyva_checkout_index_index.xml +++ b/view/frontend/layout/hyva_checkout_index_index.xml @@ -1,11 +1,11 @@ - + + after="Tagging_GTM.pusher-script"> Tagging\GTM\MageWire\Checkout Tagging\GTM\DataLayer\Event\BeginCheckout diff --git a/view/frontend/templates/hyva_checkout/data-layer.phtml b/view/frontend/templates/hyva_checkout/data-layer.phtml index 1bb0826f..fc019642 100644 --- a/view/frontend/templates/hyva_checkout/data-layer.phtml +++ b/view/frontend/templates/hyva_checkout/data-layer.phtml @@ -14,26 +14,18 @@ if (false === $magewire->isHyvaCheckoutEnabled()) { } $beginCheckoutEvent = $block->getData('begin_checkout_event'); +$beginCheckoutPayload = $beginCheckoutEvent->get(); ?> -
+