When I want to add any product (simples) to my cart the button shows a successful message, however from the main message I get: "We can't add this item to your shopping cart right now". Does not matter which product I choose, and I also tried incognito mode or reload after cache flushing.
I am running a freshly installed Magento 2.3.0 version and am in developer mode.
From the log I get the following:
main.CRITICAL: Notice: tempnam(): file created in the system's temporary directory in /www/htdocs/[...]/[...]/vendor/magento/zendframework1/library/Zend/Cache/Backend.php on line 203 {"exception":"[object] (Exception(code: 0): Notice: tempnam(): file created in the system's temporary directory in /www/htdocs/[...]/[...]/vendor/magento/zendframework1/library/Zend/Cache/Backend.php on line 203 at /www/htdocs/[...]/[...]/vendor/magento/framework/App/ErrorHandler.php:61)"} []
Starting at line 203 this is from the Backend.php:
$tempFile = tempnam(md5(uniqid(rand(), TRUE)), '');
if ($tempFile) {
$dir = realpath(dirname($tempFile));
unlink($tempFile);
if ($this->_isGoodTmpDir($dir)) {
return $dir;
}
}
Since the products are on stock, I expect them to be added to the cart properly.
EDIT
It was an issue with the temp directory. Be sure to set the 777 permission recurrsively to the var/cache directory.
But the main issue was the setting with the tmp directory. You have to edit the php.ini to explicitly set the tmp paths:
sys_temp_dir="/absolute/path/to/magento2/var/tmp"
session.save_path="/absolute/path/to/magento2/var/tmp"
session.cookie_path="/absolute/path/to/magento2/var/tmp"
OR if you do not have access to the php.ini (like I did because of my webhoster not allowing to edit it) you can make the changes in your .htaccess like this (if your hoster supports mod_env):
SetEnv TEMP /www/htdocs/your/path/mage/var/tmp
SetEnv TMP /www/htdocs/your/path/mage/var/tmp
SetEnv TMPDIR /www/htdocs/your/path/mage/var/tmp
See also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With