Skip to content

Commit bda0097

Browse files
committed
fix view-cart event again
1 parent 649944d commit bda0097

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

DataLayer/Event/ViewCart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private function getAllowedPages(): array
7272
return [];
7373
}
7474

75-
return ['/checkout/cart/'];
75+
return ['checkout/cart/'];
7676
}
7777

7878
/**
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
4+
<body>
5+
<referenceContainer name="after.body.start">
6+
<block
7+
name="yireo_googletagmanager2.cart.script-additions"
8+
template="Yireo_GoogleTagManager2::hyva/cart-script-additions.phtml"/>
9+
</referenceContainer>
10+
</body>
11+
</page>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types=1);
2+
3+
use Magento\Framework\View\Element\Template;
4+
use Yireo\GoogleTagManager2\ViewModel\Commons;
5+
6+
/** @var Template $block */
7+
/** @var Commons $commons */
8+
$commons = $block->getCommonsViewModel();
9+
?>
10+
<script>
11+
document.addEventListener('DOMContentLoaded', function () {
12+
window.dispatchEvent(new CustomEvent('minicart_collapse'));
13+
});
14+
</script>

0 commit comments

Comments
 (0)