- Issue created by @JonJacobs
- 🇺🇸United States rhovland Oregon
This is caused by changes to AddToCartForm.php
If you have a module that modifies the cart form such as a contrib module like commerce_pado or commerce_vado then check if there is an update that addresses this error.
If you have a custom module that modifies the add to cart form then the code needs to be fixed there.
- Status changed to Closed: outdated
7 months ago 9:37am 13 May 2024 - Status changed to Needs work
3 months ago 7:33am 17 September 2024 - 🇮🇳India Manav
Hi,
I faced the same in one of my commerce projects which was working fine with commerce-2.36 but after upgrading to 2.40 ver (the latest version) I got the same issue.So as per the @rhovland in #2 🐛 Error on adding product to cart Needs work I checked all my custom codes and disabled all the modules and themes but I was still facing the same issue so I downgraded to commence-2.40 to 2.36 and its resolved my issue.
I also checked with 2.37. 2.38, 2.39 but I got the same problem.
So, it means that there is not an issue with the custom code but there is something that is passing incorrect values for anonymous sessions which is creating this issue.
Drupal: 10.3
PHP: 8.3
MariaDb: 10.11I am reopening this issue as a bug for the 2.40 version.
- First commit to issue fork.
- First commit to issue fork.
- Merge request !339Issue #3419433. Adds constructor to AddToCartForm for dependency injection. → (Open) created by maximkashuba
- 🇮🇱Israel jsacksick
This isn't the right fix, the fix is to call the parent create method if you're swapping the add to cart form.
- 🇬🇪Georgia maximkashuba Batumi
For 2.40 version some services are missing during building AddToCartForm. So i added a constructor to get them.
- 🇮🇱Israel jsacksick
But do you have any custom or contrib code extending the add to cart form? If that is the case, they should be calling the parent create() method.
- 🇬🇪Georgia maximkashuba Batumi
yes, you are right. The form is extended changed the create method. Works as expected.
Thank you.