Anchor to giftCardsCountgift
giftCardsCount
query
Requires access scope.
The total number of gift cards issued for the shop. Limited to a maximum of 10000.
Anchor to Arguments
Arguments
- Anchor to queryquery•
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
- Anchor to balance_status•string
full
partial
empty
full_or_partial
balance_status:full
- Anchor to created_at•time
created_at:>=2020-01-01T12:00:00Z
- Anchor to expires_on•date
expires_on:>=2020-01-01
- Anchor to initial_value•string
initial_value:>=100
- Anchor to status•string
disabled
enabled
expired
expiring
status:disabled OR status:expired
Valid values:
Example:
Example:
Example:
Example:
Valid values:
Example:
- Anchor to savedSearchIdsaved•
Search Id
Was this section helpful?
Anchor to Possible returnsPossible returns
- Anchor to CountCount•
Details for count of elements.
Was this section helpful?
- Get the total number of enabled gift cards that are issued for the shop
- Retrieves a count of gift cards
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
giftCardsCount(query: "status:enabled") {
count
}
}`,
);
const data = await response.json();
query {
giftCardsCount(query: "status:enabled") {
count
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { giftCardsCount(query: \"status:enabled\") { count } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
giftCardsCount(query: "status:enabled") {
count
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
giftCardsCount(query: "status:enabled") {
count
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
giftCardsCount(query: "status:enabled") {
count
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"giftCardsCount": {
"count": 10
}
}