Adding products to the cart throws a page not found (404) error that has this header;

Page not found.
↵
Caused by: Invalid Route – yii\base\InvalidRouteException
Unable to resolve the request: commerce/cart/updateCart
in /Users/a/Sites/ae-dev/vendor/yiisoft/yii2/base/Controller.php at line 128

Very strange. Anyone encounter this issue?

up vote 2 down vote accepted

Based on your tag, I assume you're using Commerce 2.

Controller actions in Craft 3 use kebab-case, now, so your action should be commerce/cart/update-cart.

  • Thanks—now I'm not getting an error, but nothing gets added to the cart, and instead of the cart redirect I get sent to the homepage. – Anders Jul 22 at 5:35
  • Somehow managed to sort it out with purchasable.purchasableId instead of purchasable.getId, but the redirect is still wrong... – Anders Jul 22 at 8:03

Ah, my bad—not as simple as copy-pasting from Commerce 1 (duh). Some aspects have changed, like kebab-case and {{ redirectInput('shop/cart') }}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.