Hi @kapil-infobeans. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento-engcom-team give me $VERSION instance
where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.
@kapil-infobeans do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@magento-engcom-team give me 2.2.5 instance
Hi @kapil-infobeans. Thank you for your request. I'm working on Magento 2.2.5 instance for you
Hi @kapil-infobeans, here is your Magento instance.
Admin access: https://i-18536-2-2-5.engcom.dev.magento.com/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
@magento-engcom-team Is it EE 2.2.5 instance? It's only reproducible on EE 2.2.5.
I am able to reproduce this on Magento 2.2.1. Not consistently, but it is occurring under the same scenario.
@magento-engcom-team The issue here is that Magento\GoogleTagManager\Model\Plugin\Quote\SetGoogleAnalyticsOnCartRemove::afterRemoveItem does not add a conditional to check whether the $item exists before calling $item->getQty(), something like the following would fix:
public function afterRemoveItem(\Magento\Quote\Model\Quote $subject, $result, $itemId)
{
$item = $subject->getItemById($itemId);
if (!$item) {
return $result;
}
$this->setItemForTriggerRemoveEvent($this->helper, $this->registry, $item, $item->getQty());
return $result;
}
Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Verify that the issue is reproducible on 2.2-develop branch. Details
- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x
[ ] 6. Add label Issue: Confirmed once verification is complete.
[ ] 7. Make sure that automatic system confirms that report has been added to the backlog.
HI @kapil-infobeans I'm not able to reproduce following steps your described, because google-tag-manager exist only in ee version, Please follow these guidelines for proper tracking of your issue. You can report Commerce-related issues in one of two ways:
You can use the Support portal associated with your account
or
If you are a Partner reporting on behalf of a merchant, use the Partner portal.
GitHub is intended for Magento Open Source users to report on issues related to Open Source only. There are no account management services associated with GitHub.
I came across this issue and made a module to fix it.
The use of a preference was due to the use of private for a lot of variables.
https://github.com/WeareJH/m2-module-google-tag-manager-fixes
For further clarification on replication steps.
We have found it is reproducable if you:
or
Most helpful comment
@magento-engcom-team The issue here is that
Magento\GoogleTagManager\Model\Plugin\Quote\SetGoogleAnalyticsOnCartRemove::afterRemoveItemdoes not add a conditional to check whether the$itemexists before calling$item->getQty(), something like the following would fix: