Magento 2 GraphQL Cheatsheet 2025

Magento 2 GraphQL Cheatsheet 2025

Magento 2 has embraced an API-first approach with robust GraphQL support, making it a go-to choice for headless commerce and modern frontend frameworks like React, Vue, and PWA Studio. This Magento 2 GraphQL Cheatsheet 2025 is your go-to hub that links all my hands-on GraphQL tutorials, organized section-wise with real-life examples and ready-to-use code.

Whether you’re a frontend developer building a custom React UI or a Magento backend dev testing APIs with Altair or GraphiQL, this post will fast-track your development.


Customer

Everything you need to manage customers — registration, authentication, and email validation.

🔹 Create Customer Account Using Magento 2 GraphQL
Learn how to register a new customer using the createCustomerV2 mutation.

🔹 Generate Customer Token Using Magento 2 GraphQL
Use the generateCustomerToken mutation to authenticate and fetch a JWT token.

🔹 Check Email Availability in Magento 2 Using GraphQL
Verify if a customer email is already registered using the isEmailAvailable query.

Company (Adobe Commerce B2B)

For B2B stores on Adobe Commerce — validate company admin/user emails.

🔹 Check Company, Customer, and Admin Email Availability
Covers isCompanyEmailAvailable query to validate:

  • Company Admin Emails
  • Company User Emails
  • Customer Emails

Orders

(Coming Soon)
Planned tutorials to include:

  • Fetch customer order history
  • View individual order details
  • Cancel orders via GraphQL

Wishlist

(Coming Soon)
Planned tutorials to include:

  • Add product to wishlist
  • Get wishlist items
  • Remove wishlist item

Cart & Checkout

(Coming Soon)
Planned tutorials:

  • Add product to cart (addSimpleProductsToCart)
  • Update item quantity
  • Remove cart items
  • Set shipping and billing address
  • Fetch available shipping/payment methods
  • Place order (placeOrder)

Authentication & Tokens

This overlaps with the Customer section but is critical enough to highlight separately.

🔹 Generate Customer Token Using GraphQL
Get secure access tokens to authorize customer actions in the storefront.


Store Configuration / Metadata

(Coming Soon)
Planned GraphQL tutorials:

  • Fetch store configurations
  • Get currency, locale, store view details
  • Load CMS page or blocks via GraphQL

This blog will evolve. Bookmark it or subscribe to my newsletter for updates as I publish more Magento 2 GraphQL content.


How to Check Email Availability in Magento 2 Using GraphQL

How to Check Email Availability in Magento 2 Using GraphQL (2.4.7+)

In Magento 2, especially when building custom frontends with PWA Studio, Vue Storefront, or any headless frontend using GraphQL, it's important to know whether a customer's email is already registered before account creation.

Magento provides a simple query for this: isEmailAvailable.

But starting from Magento 2.4.7, its behavior has slightly changed and may lead to confusion if you're unaware of the config setting involved. Let’s break it down.


What is isEmailAvailable?

The isEmailAvailable GraphQL query allows you to verify if an email address is already associated with an existing customer account.

  • Returns true if the email is available to create a new account.
  • Returns false if the email is already in use.

But in Magento 2.4.7 and later, the behavior is modified for privacy and security reasons.

Important Change in Magento 2.4.7

By default, Magento 2.4.7 always returns:

{
  "data": {
    "isEmailAvailable": {
      "is_email_available": true
    }
  }
}

Even for already registered emails.

Why?

To prevent exposing customer data (like whether someone’s email exists on your store), Magento now hides that information unless you explicitly allow it.


How to Enable Real Email Availability Check?

To restore the actual checking behavior:

  1. Go to your Magento Admin
  2. Navigate to: Stores > Configuration > Sales > Checkout
  3. Set Enable Guest Checkout Login to Yes

⚠️ Warning: Enabling this will reveal email existence status to unauthenticated users, which could lead to privacy concerns.


GraphQL Syntax

{
  isEmailAvailable(email: "customer@example.com") {
    is_email_available
  }
}

Parameters

  • email (String!): The email you want to check.

Example Usage

Request

{
  isEmailAvailable(email: "hello@jigarkarangiya.com") {
    is_email_available
  }
}

Response

{
  "data": {
    "isEmailAvailable": {
      "is_email_available": true
    }
  }
}

  • true → Email is available
  • false → Email is already in use

When to Use This?

In custom signup flows to give users instant feedback

During customer registration on headless frontends

For progressive web apps (PWAs)


Related Resources


The isEmailAvailable GraphQL query is a useful tool in building smarter and user-friendly registration forms for your Magento 2 store. But with Magento 2.4.7, don’t forget the behavior change — it now always returns true unless you configure it otherwise.

You may also like,

How to Generate a Customer Token Using Magento 2 GraphQL

How to Create a Customer Account Using Magento 2 GraphQL