Complete guide to querying WooCommerce Subscriptions via GraphQL - customer subscriptions, subscription fields, and relationships.
This guide covers all subscription query capabilities provided by WooGraphQL Pro.
Query a specific subscription by ID:
query GetSubscription($id: ID!) { customer { subscription(id: $id) { id databaseId status billingPeriod billingInterval startDate trialDate lastPaymentDate nextPaymentDate endDate cancelledDate requiresManualRenewal total subtotal totalTax } } }
Query all subscriptions for the authenticated customer:
query GetMySubscriptions($first: Int, $after: String) { customer { subscriptions(first: $first, after: $after) { pageInfo { hasNextPage endCursor } nodes { id databaseId status billingPeriod billingInterval nextPaymentDate total } } } }
query GetActiveSubscriptions { customer { subscriptions(where: { status: ACTIVE }) { nodes { id status nextPaymentDate } } } }
| Field | Type | Description |
|---|---|---|
id | ID! | Global Relay ID |
databaseId | Int! | WordPress database ID |
status | SubscriptionStatusesEnum | Current subscription status |
billingPeriod | String | Billing period (day, week, month, year) |
billingInterval | Int | Billing interval (e.g., every 2 months) |
requiresManualRenewal | Boolean | Whether manual renewal is required |
currentPaymentTokenId | Int | DB id of the customer's saved payment token currently set on the subscription, or null when the active source isn't a saved token. Owner-only — returns null for anyone other than the subscription's customer (including admins) |
hasPaymentMethodSet | Boolean | Whether the subscription has an automatic payment method set for renewals. Readable by admins; reveals no token details |
| Field | Type | Description |
|---|---|---|
startDate | String | When the subscription started |
trialDate | String | When the trial period ends |
lastPaymentDate | String | Date of last successful payment |
nextPaymentDate | String | Date of next scheduled payment |
endDate | String | When the subscription ends (if set) |
cancelledDate | String | When the subscription was cancelled |
| Field | Type | Description |
|---|---|---|
total | String | Subscription total |
subtotal | String | Subtotal before tax |
totalTax | String | Total tax amount |
Query the products included in a subscription:
query GetSubscriptionLineItems($id: ID!) { customer { subscription(id: $id) { lineItems { nodes { product { node { id name ... on SubscriptionProduct { subscriptionPrice subscriptionPeriod } } } quantity total subtotal } } } } }
query GetSubscriptionBilling($id: ID!) { customer { subscription(id: $id) { billing { firstName lastName company address1 address2 city state postcode country email phone } } } }
Query orders associated with a subscription:
query GetSubscriptionOrders($id: ID!) { customer { subscription(id: $id) { orders { nodes { id databaseId status total date } } } } }
Check if a subscription was resubscribed from another:
query GetResubscriptionInfo($id: ID!) { customer { subscription(id: $id) { resubscribedFrom { id status } resubscribedSubscription { id status } } } }
availableForMigration lists the subscription products this subscription can switch to. Eligibility mirrors WooCommerce Subscriptions' own switch rules (wcs_is_product_switchable_type), so it honors the store's switching settings — WooCommerce → Settings → Subscriptions → "Allow Switching" ("Between Subscription Variations" / "Between Grouped Subscriptions") — and excludes products already on the subscription. It is not affected by a product's purchase-limit setting.
The connection accepts the standard product connection arguments, so results can be filtered, ordered, and paginated — e.g. limit to in-stock products. Each edge also exposes itemId, the subscription line item the target applies to.
query GetMigrationOptions($id: ID!) { customer { subscription(id: $id) { availableForMigration(first: 20, where: { stockStatus: IN_STOCK }) { edges { itemId node { id name ... on SubscriptionProduct { subscriptionPrice subscriptionPeriod } } } } } } }
Query subscriptions created from a specific order:
query GetOrderSubscriptions($orderId: ID!) { order(id: $orderId, idType: DATABASE_ID) { subscriptions { nodes { id status nextPaymentDate } } } }
A comprehensive query for subscription details:
query GetFullSubscription($id: ID!) { customer { subscription(id: $id) { # Identity id databaseId status # Billing Schedule billingPeriod billingInterval requiresManualRenewal # Dates startDate trialDate lastPaymentDate nextPaymentDate endDate cancelledDate # Totals total subtotal totalTax # Billing Address billing { firstName lastName email phone address1 city state postcode country } # Products lineItems { nodes { product { node { id name image { sourceUrl } } } quantity total } } # Related orders(first: 5) { nodes { id status total date } } # Migration availableForMigration { nodes { id name } } } } }
Subscription queries require authentication. The customer can only query their own subscriptions. Admin users can query any subscription.