cancel
Showing results for 
Search instead for 
Did you mean: 

Error when "Add to Cart" - Error message "We can't add this item to your shopping cart right now"

SOLVED

Error when "Add to Cart" - Error message "We can't add this item to your shopping cart right now"

Hi All

 

When I press "Add to Cart", there is error message

 

"We can't add this item to your shopping cart right now."

 

Any idea for the issue?

 

Please help

 

Regards

 

Andy

7 REPLIES

Re: Error when "Add to Cart" - Error message "We can't add this item to your shoppin

Hi @andykfwoo,

 


That is a generic error message but it's not really providing the required information in order to debug the issue.

I suggest to enable developer mode using the Magento command-line tool to log errors:

bin/magento deploy:mode:set developer

Then, you should check the var/log folder to see the error message or add a breakpoint before that exception is generated to debug.

 

 

Best regards.

Gabriel

If my answer was useful, please give "Kudos" to this post.
If my answer helps you to resolve the problem, click on "Accept as Solution".

Re: Error when "Add to Cart" - Error message "We can't add this item to your shoppin

"We can't add this item to your shopping cart right now" is a generic message which hides some internal exteption.
Please see the exception log in the var/log directory or set a breakpoint in the code point where the message is generated.

Re: Error when "Add to Cart" - Error message "We can't add this item to your shoppin

Hi

Thanks for your help first. Actually, I am no programmer and I have limited knowledge the trace the program. I check the log file below
/var/log/debug.log and found below message, do you have any idea?

Regards

Andy

 

error1.JPG

Re: Error when "Add to Cart" - Error message "We can't add this item to your shoppin

I found the solution
Go to
/vendor/magento/zendframework1/library/Zend/Cache/Backend
and edit the file.php
Search for 'cache_dir' => null,
and replace it with
'cache_dir' => 'var/cache',
DONE!
For us it worked well.

Re: Error when "Add to Cart" - Error message "We can't add this item to your shoppin

This isn't solution, its a trick which good programmers hate the most.

Re: Error when "Add to Cart" - Error message "We can't add this item to your shoppin

I too have the same problem and I am not able to resolve the same. The same code works fine on the staging environment but not on production. Find extract from exception.log

 

#44 /<magento dir>vendor/magento/module-page-cache/Model/App/FrontController/VarnishPlugin.php(55): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#45 /<magento dir>vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\PageCache\Model\App\FrontController\VarnishPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#46 /<magento dir>vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#47 /<magento dir>vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(68): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#48 /<magento dir>vendor/magento/framework/Interception/Interceptor.php(142): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#49 /<magento dir>var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#50 /<magento dir>vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#51 /<magento dir>vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#52 /<magento dir>pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#53 {main} [] []

 

 

Highlighted

Re: Error when "Add to Cart" - Error message "We can't add this item to your shoppin

Moppelfett, this good solution, thank you so much!Smiley Happy