Skip to main content

Storefront GraphQL API

The Storefront API is designed to support building themes and frontend features, enabling developers to create and customize the customer-facing elements of an e-commerce website. It facilitates key interactions like browsing product catalogs, managing shopping carts, and completing checkout processes. These APIs enhance the customer experience, whether displaying product information, managing customer carts, or processing payments. By leveraging the Storefront API, developers can build a seamless and engaging shopping experience, essential for driving sales and improving customer satisfaction.

Given below are the examples of Storefront GraphQL API:

  1. Send OTP to the customer for shipment verification, for example, sendOtpForRefundBankDetails.
  2. Retrieve product details such as price, attributes, HSN code, and SKU code. For example, product.

GraphQL is a query language for APIs and a runtime for executing those queries using a type system you define for your data. It allows clients to request the data they need, making it more efficient than traditional REST APIs.

Reference

Refer to Storefront GraphQL API for the full list of APIs available.

Example

E-commerce needs to allow users or administrators to fetch detailed information about a specific customer address stored in the system. This includes critical details such as the recipient's name, street address, city, postal code, and other related metadata. A customer has multiple saved addresses in their account. When they are checking out, the system needs to fetch the details of the selected address to auto-fill the shipping section of the checkout page.

Query

query address(
$id: String!
$buyNow: Boolean
$cartId: String
$checkoutMode: String
$isDefault: Boolean
$mobileNo: String
$tags: String
) {
address(
id: $id
buyNow: $buyNow
cartId: $cartId
checkoutMode: $checkoutMode
isDefault: $isDefault
mobileNo: $mobileNo
tags: $tags
) {
custom_json
address
address_type
area
area_code
area_code_slug
checkout_mode
app_id
city
country
country_code
country_iso_code
country_phone_code
created_by_user_id
email
geo_location {
latitude
longitude
}
google_map_point
id
is_active
is_default_address
landmark
meta
name
phone
state
tags
uid
user_id
sector
state_code
is_anonymous
}
}

Input Variable

{
"id": "08a16b83-9094-4e89-8c05-2ccadd5c1c7e",
"buyNow": true,
"cartId": "cartId",
"checkoutMode": "checkoutMode",
"isDefault": true,
"mobileNo": "mobileNo",
"tags": "tags"
}

Response

{
"address": {
"custom_json": {},
"address": "2832 Sesame Street",
"address_type": "shipping",
"area": "Downtown",
"area_code": "12345",
"area_code_slug": "area123",
"checkout_mode": "standard",
"app_id": "app123",
"city": "Montreal",
"country": "Canada",
"country_code": "CA",
"country_iso_code": "CA",
"country_phone_code": "+1",
"created_by_user_id": "user123",
"email": "test-email@yourcompany.com",
"geo_location": {
"latitude": 30.7,
"longitude": 30.7
},
"google_map_point": {},
"id": "08a16b83-9094-4e89-8c05-2ccadd5c1c7e",
"is_active": true,
"is_default_address": true,
"landmark": "Near the central park",
"meta": {},
"name": "John Doe",
"phone": "1+ 418-323-4236",
"state": "Quebec",
"tags": ["home"],
"uid": 42,
"user_id": "user_id",
"sector": "urban",
"state_code": "QC",
"is_anonymous": false
}
}

The system retrieves the full address information (including name, phone, address, city, and more) associated with the provided address ID.


Was this section helpful?