From fe9c408ec25088b94bf9668f83649916bb95868d Mon Sep 17 00:00:00 2001 From: Torben Lundsgaard Date: Fri, 25 Oct 2024 16:33:56 +0200 Subject: [PATCH] Fix matching endpoints for cart and checkout --- changelog.txt | 3 +++ readme.txt | 1 + src/Integration/WooCommerce.php | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 5462a81..69836d8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ *** GTM Kit *** +2024-10-DD - version 2.2.1 +* Fix: If the cart and checkout endpoints where set to the same page in order to skip the cart the 'checkout' and 'purchase' events would not fire. + 2024-10-16 - version 2.2.0 * Add: Added notifications and warnings for missing GTM container, debug log usage, auto-update and event inspector usage. These improvements aim to ensure smooth production operations. diff --git a/readme.txt b/readme.txt index 67d89a2..5f2605b 100644 --- a/readme.txt +++ b/readme.txt @@ -101,6 +101,7 @@ Find out about what's new in our [our release post](https://gtmkit.com/gtm-kit-2 #### Enhancements: #### Bugfixes: +* If the cart and checkout endpoints where set to the same page in order to skip the cart the 'checkout' and 'purchase' events would not fire. #### Other: diff --git a/src/Integration/WooCommerce.php b/src/Integration/WooCommerce.php index 4c91f6f..16e5ba4 100644 --- a/src/Integration/WooCommerce.php +++ b/src/Integration/WooCommerce.php @@ -348,12 +348,12 @@ public function get_datalayer_content( array $data_layer ): array { $data_layer = $this->get_datalayer_content_product_category( $data_layer ); } elseif ( is_product_tag() ) { $data_layer = $this->get_datalayer_content_product_tag( $data_layer ); - } elseif ( is_cart() ) { - $data_layer = $this->get_datalayer_content_cart( $data_layer ); } elseif ( is_order_received_page() ) { $data_layer = $this->get_datalayer_content_order_received( $data_layer ); } elseif ( is_checkout() ) { $data_layer = $this->get_datalayer_content_checkout( $data_layer ); + } elseif ( is_cart() ) { + $data_layer = $this->get_datalayer_content_cart( $data_layer ); } if ( $this->options->get( 'integrations', 'woocommerce_include_permalink_structure' ) ) {