GraphQL checkout tutorial
Step 2. Create an empty cart
The createEmptyCart
mutation creates an empty shopping cart and generates a cart ID.
For logged-in customers, send the customer’s authorization token in the Authorization parameter of the header. See “Get customer authorization token” for more information.
Request:
The following mutation creates an empty cart:
1
2
3
mutation {
createEmptyCart
}
Response:
1
2
3
4
5
{
"data": {
"createEmptyCart": "A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h"
}
}
In the subsequent tutorial steps, the unique shopping cart identifier A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h
will be listed as { CART_ID }
.
Verify this step
There are no additional verification steps. The values of quote
and entity_id
value are not displayed on the website or in the Magento Admin.