Skip to content

Commit

Permalink
Fixed stepNavigator issue in non-default checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Jun 26, 2023
1 parent f39d29e commit d1cd0fb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.4.4] - 26 June 2023
### Fixed
- Fixed stepNavigator issue in non-default checkout

## [3.4.3] - 22 June 2023
### Fixed
- Mixins are still active even when enabled = false

## [3.4.2] - 21 June 2023
### Fixed
- Prevent add-to-cart to trigger view-cart, when view-cart is on cart-page only
- Missing Quantity Parameter in add_to_cart Event
- Missing Quantity Parameter in `add_to_cart` Event

## [3.4.1] - 20 June 2023
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yireo/magento2-googletagmanager2",
"version": "3.4.3",
"version": "3.4.4",
"license": "OSL-3.0",
"type": "magento2-module",
"homepage": "https://www.yireo.com/software/magento-extensions/googletagmanager2",
Expand Down
23 changes: 16 additions & 7 deletions view/frontend/web/js/mixins/step-navigator-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@ define([
}

stepNavigator.steps.subscribe(function (steps) {
if (steps[0].isVisible()) {
const eventData = window.YIREO_GOOGLETAGMANAGER2_BEGIN_CHECKOUT;
const firstStep = steps[0];
if (firstStep === undefined || firstStep == null || firstStep.length <= 0) {
logger('Error: No steps detected. Triggering event anyway :o')
pusher(eventData, 'push (page event "begin_checkout") [step-navigator-mixin.js]');
return;
}

if (eventData === null || eventData === undefined) {
logger('skipped "begin_checkout" event because data is empty')
return;
}
if (!firstStep.isVisible()) {
return;
}

const eventData = window.YIREO_GOOGLETAGMANAGER2_BEGIN_CHECKOUT;

pusher(eventData, 'push (page event "begin_checkout") [step-navigator-mixin.js]');
if (eventData === null || eventData === undefined) {
logger('skipped "begin_checkout" event because data is empty')
return;
}

pusher(eventData, 'push (page event "begin_checkout") [step-navigator-mixin.js]');
});

return stepNavigator;
Expand Down

0 comments on commit d1cd0fb

Please sign in to comment.