I'm busy developing a Magento 2 theme. Now I updated my local and production server to Magento 2 (the latest release from yesterday). Since this version I get this error when I try to add a product to the cart:

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

This is a general error, so it's hard to find out what the real error is here. I checked all standard stuff, like if the item is in stock etc. I disabled my theme to check if it's something in my theme, but the error was still thrown after this.

In the log file I did find this error:

main.CRITICAL: Exception message: Each getter must have description with @return annotation. See Magento\Tax\Api\Data\TaxDetailsInterface::getSubtotal()

If I open this file, I see this:

 * Get subtotal
 * @return float
public function getSubtotal();

This does look like a fine annotation to me. I have this on multiple installations now.

Does anyone have the same error?


Checkout in Magento 2 relies on Magento REST Web API to retrieve data.

All methods exposed as Web API must have proper @param and @return annotations (including Data interfaces which are referenced in annotations of service method).

Magento\Tax\Api\Data\TaxDetailsInterface::getSubtotal() has proper annotation, but for some reason on your installation \Zend\Code\Reflection\Method\Reflection::getDocBlock() does not see these annotation in \Magento\Framework\Reflection\TypeProcessor::getGetterReturnType(). Try to debug locally in this direction.

  • Thank you, I did a reinstall on my local environment and it all works now. I don't know where it went wrong, but somehow Magento created this error I think? It's not in my extensions/theme because I enabled them again on my reinstalled Magento version and it does work properly. – Silvan Nov 19 '15 at 9:55
  • So I have the same issue again with my fresh installation, this is really weird. I dit check Magento\Tax\Api\Data\TaxDetailsInterface::getSubtotal() and it does have a return annotation. I don't understand, why is the error still thrown? – Silvan Nov 26 '15 at 19:26
  • It is actually not random, see my updated comment. Probably no one used that service via REST before. – Alex Paliarush Nov 26 '15 at 20:03
  • So I should add @return float to getSubtotal() in \Magento\Tax\Model\TaxDetails\TaxDetails? I tried this, but it's still not working. It's not that I'm trying to do something advanced, I'm just trying to add a product to my cart from the frontend. – Silvan Nov 26 '15 at 20:16
  • Looks like implementation can now have any annotations. Just tried to break product API by removing some getter annotations from product model and it still works (while removing annotation from interface causes such error). Please try to debug locally or provide more detailed steps how to reproduce the issue. I cannot reproduce it using provided description. – Alex Paliarush Nov 26 '15 at 21:47

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.

  • You're right, there was an error in the log. I updated my question. – Silvan Nov 19 '15 at 8:13

After a deep search on the web for "We can't add this item to your shopping cart right now" on the detail page, you can look into the following:

  1. OPcache
  2. Cookie session
  3. TIMEZONE!!!!!!!! on your server setting

Believe me, the timezone will kill all the session and so you will end up with the cache problem, whether you have setup OPcache and Cookie.

Those people that fixed the cache and get the fix should be because they are located in the US.

I have tried almost all the method that I can found on google and the community, ended up with the timezone setting problem...

not because of the formwork, not because of the plugin and code.

Of course, there might be something went wrong in other places, but please try to change your server timezone and magento timezone, make them sync and reboot the server, it should work like charm!



After a long time searching we found out that OPcache caused this error. We switched to another cache module, now everything works perfect.

  • Hi Silvan .. i have ran cache status its does not show opcache . can you tell me how to switch opcache to another mode. – Sarvesh Tiwari Jul 12 '17 at 14:33

I ran into same satiation after importing products. By following these step i get it fixed

  • php bin/magento cache:clean
  • php bin/magento cache:flush
  • php bin/magento indexer:reindex

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.

  • 1
    This is not a solution, you should never ever manually edit any files in the vendor directory. These are third party libraries and should not be touched. – Danny Nimmo Mar 5 '17 at 11:18

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.