I've been following the Craft Commerce tutorials at Mijingo, (running on CraftPro 2.6.2983) all good so far, except when I go add a product to my cart. I'm getting a "CSRF token could not be found" error.

The debug message with dev mode on reads:

Warning: Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in /Users/username/projectname/craft/app/services/UserSessionService.php on line 17

Warning: Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in /Users/username/projectname/craft/app/services/UserSessionService.php on line 17

Is there a step or setup option I'm missing? Atm, it's running on Mamp, but I want to make sure it's workable before I license up and go live.

  • Glad you got it sorted! Would you mind adding your edit as an official answer in case someone else runs into it in the future?
    – Brad Bell
    Jun 21 '17 at 20:40

My bad - sorted it out by adding {{ getCsrfInput() }} - as per https://craftcms.com/support/csrf-protection

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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