|
12 | 12 | use Magento\Quote\Model\ShippingMethodManagementInterface; |
13 | 13 | use Yireo\GoogleTagManager2\Api\Data\EventInterface; |
14 | 14 | use Yireo\GoogleTagManager2\DataLayer\Tag\Cart\CartItems; |
| 15 | +use Yireo\GoogleTagManager2\DataLayer\Tag\Cart\CartValue; |
15 | 16 |
|
16 | 17 | class AddShippingInfo implements EventInterface |
17 | 18 | { |
18 | 19 | private CartItems $cartItems; |
| 20 | + private CartValue $cartValue; |
19 | 21 | private ShippingMethodManagementInterface $shippingMethodManagement; |
20 | 22 | private CheckoutSession $checkoutSession; |
21 | 23 |
|
22 | 24 | /** |
23 | 25 | * @param CartItems $cartItems |
| 26 | + * @param CartValue $cartValue |
24 | 27 | * @param ShippingMethodManagementInterface $shippingMethodManagement |
25 | 28 | * @param CheckoutSession $checkoutSession |
26 | 29 | */ |
27 | 30 | public function __construct( |
28 | 31 | CartItems $cartItems, |
| 32 | + CartValue $cartValue, |
29 | 33 | ShippingMethodManagementInterface $shippingMethodManagement, |
30 | 34 | CheckoutSession $checkoutSession |
31 | 35 | ) { |
32 | 36 | $this->cartItems = $cartItems; |
| 37 | + $this->cartValue = $cartValue; |
33 | 38 | $this->shippingMethodManagement = $shippingMethodManagement; |
34 | 39 | $this->checkoutSession = $checkoutSession; |
35 | 40 | } |
@@ -57,6 +62,8 @@ public function get(): array |
57 | 62 | return [ |
58 | 63 | 'event' => 'add_shipping_info', |
59 | 64 | 'ecommerce' => [ |
| 65 | + 'currency' => $quote->getQuoteCurrencyCode(), |
| 66 | + 'value' => $this->cartValue->get(), |
60 | 67 | 'shipping_tier' => $shippingMethod, |
61 | 68 | 'items' => $this->cartItems->get(), |
62 | 69 | ], |
|
0 commit comments