33namespace Stape \Gtm \Plugin \Checkout \Cart ;
44
55use Magento \Checkout \Controller \Cart \Delete ;
6+ use Magento \Checkout \Controller \Sidebar \RemoveItem ;
67use Magento \Checkout \Model \Session as CheckoutSession ;
78use Magento \Framework \Pricing \PriceCurrencyInterface ;
89use Psr \Log \LoggerInterface ;
@@ -71,19 +72,21 @@ public function __construct(
7172 /**
7273 * Add remove from cart event
7374 *
74- * @param Delete $subject
75+ * @param Delete|RemoveItem $subject
7576 * @param callable $proceed
7677 * @return mixed
7778 * @throws \Magento\Framework\Exception\LocalizedException
7879 * @throws \Magento\Framework\Exception\NoSuchEntityException
7980 */
80- public function aroundExecute (Delete $ subject , callable $ proceed )
81+ public function aroundExecute ($ subject , callable $ proceed )
8182 {
8283 if (!$ this ->configProvider ->isActive ()) {
8384 return $ proceed ();
8485 }
8586
86- $ itemId = (int ) $ subject ->getRequest ()->getParam ('id ' );
87+ $ request = $ subject ->getRequest ();
88+ $ itemId = (int ) ($ request ->getParam ('id ' ) ?: $ request ->getParam ('item_id ' ));
89+
8790 $ quote = $ this ->checkoutSession ->getQuote ();
8891 /** @var \Magento\Quote\Model\Quote\Item $item */
8992 if (!$ item = $ quote ->getItemById ($ itemId )) {
@@ -97,6 +100,7 @@ public function aroundExecute(Delete $subject, callable $proceed)
97100
98101 if ($ item ->isDeleted ()) {
99102 $ this ->dataProvider ->add ('remove_from_cart ' , [
103+ 'value ' => $ this ->priceCurrency ->round ($ item ->getBasePriceInclTax ()),
100104 'items ' => [
101105 [
102106 'item_name ' => $ item ->getName (),
0 commit comments