Magento – Magento2 REST API – Cannot create cart/quote for customer

apicartmagento2restrest api

I am building a shoppingcart using the Magento2 Rest API and I want to create a cart for a customer and (if not logged in) for a guest.

For guest carts is it working:

Create a guestcart:

POST /V1/guest-carts returns :cartId

Get guestcart:

GET /V1/guest-carts/:cartId returns cartObject

Fine so far, but for a customer who is logged in (using a customerToken) it doesn't work:

Create a customercart (using the customertoken):

POST /V1/carts/mine returns [message] => Cannot create quote

So i tried this workaround (using API token) but it returns the same message:

Create a customercart (using the API token):

POST /V1/customers/:customerId/carts returns [message] => Cannot create quote

I get the same result for different customers.

Does anyone has a clue?

Using Magento 2.2.5

TRACE

0 [internal function]: Magento\Quote\Model\QuoteManagement->createEmptyCartForCustomer(3)

1 /vendor/magento/module-webapi/Controller/Rest.php(330): call_user_func_array(Array, Array)

2 /vendor/magento/module-webapi/Controller/Rest.php(239): Magento\Webapi\Controller\Rest->processApiRequest()

3 /vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))

4 /vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent(dispatch, Array)

5 /vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))

6 /generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(39): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)

7 /vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))

8 generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()

9 /vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()

10 index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))

Best Answer

Guess what!? The problem was related to a Plesk setting overwriting the PHP include_path

https://github.com/magento/magento2/issues/10821#issuecomment-334525946

Related Topic