MageSmith
MutationQuote · Magento 2.4.9 Deprecated

createEmptyCart

createEmptyCart is a Magento 2 GraphQL mutation in the Quote module. Create an empty shopping cart for a guest or logged in user. It returns String and requires an Authorization header (Bearer customer token).

Deprecated: Use `Mutation.createGuestCart` or `Query.customerCart` for logged in customer

Last verified: against Magento 2.4.9.

Returns

String

Resolver class

\Magento\QuoteGraphQl\Model\Resolver\CreateEmptyCart

Arguments

An optional input object that assigns the specified ID to the cart.

Example request

Auto-generated from the SDL — paste-ready against your store's /graphql endpoint. Replace the host, store code, and any required values before running.

Headers

Content-Type
application/json
Store
default store view code; use 'default' for the single-store baseline
Authorization
Bearer <CUSTOMER_TOKEN> obtain from generateCustomerToken mutation

Query

mutation {
  createEmptyCart
}

Variables

{}

Every Magento dev tool, in one hosted workspace.

Free to sign up. Nothing to install. Drafts, audits, and projects saved across every tool.