Skip to content

Commit cbe53ae

Browse files
authored
Merge pull request #81 from webmatch/feature/WBMSWPLUG-126
[TASK] fix addToCart and removeFromCart by updating the check for scope
2 parents e08ab88 + 9433840 commit cbe53ae

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 2.2.4
2+
* fix addToCart and removeFromCart by updating the check for scope
3+
14
# 2.2.3
25
* rebuild storefront with latest shopware version to prevent error in console
36

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "webmatch/tag-manager-sw6",
33
"keywords": ["shopware6", "shopware-6", "GTM", "datalayer", "datalayer-configuration", "google-tag-manager", "shopware-plugin"],
44
"description": "Google Tag Manager + Enhanced E-Commerce Tracking",
5-
"version": "2.2.3",
5+
"version": "2.2.4",
66
"type": "shopware-platform-plugin",
77
"license": "proprietary",
88
"require": {

src/Subscriber/KernelEventsSubscriber.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Wbm\TagManagerEcomm\Subscriber;
44

5-
use Shopware\Core\Framework\Routing\Annotation\RouteScope;
5+
use Shopware\Core\Framework\Context;
66
use Shopware\Core\Framework\Routing\KernelListenerPriorities;
77
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
88
use Symfony\Component\HttpFoundation\Request;
@@ -128,9 +128,9 @@ public function prependDataLayerToResponse(ResponseEvent $event): void
128128

129129
private function isStorefrontRequest(Request $request)
130130
{
131-
if ($request->attributes->has('_routeScope')
132-
&& $request->attributes->get('_routeScope') instanceof RouteScope
133-
&& $request->attributes->get('_routeScope')->hasScope('storefront')
131+
if ($request->attributes->has('sw-context')
132+
&& $request->attributes->get('sw-context') instanceof Context
133+
&& $request->attributes->get('sw-context')->getScope() === 'user'
134134
) {
135135
return true;
136136
}

0 commit comments

Comments
 (0)