data-src=../../../../includes/saas-only.md

isSubscribedProductAlertStock query

The isSubscribedProductAlertStock query checks whether the logged-in customer is subscribed to a stock availability alert for the specified product. Use this query to determine whether to show a subscribe or unsubscribe option in the storefront UI.

This query requires a valid customer authentication token.

Syntax

{
  isSubscribedProductAlertStock(
    input: ProductAlertStockInput!
  ): IsProductAlertSubscriptionResult!
}

Reference

The isSubscribedProductAlertStock reference provides detailed information about the types and fields defined in this query.

Example usage

The following example checks whether the logged-in customer is subscribed to a stock alert for the product with SKU ADB111.

Request:

{
  isSubscribedProductAlertStock(
    input: { sku: "ADB111" }
  ) {
    isSubscribed
    message
  }
}

Response (subscribed):

{
  "data": {
    "isSubscribedProductAlertStock": {
      "isSubscribed": true,
      "message": "You are already subscribed to this product."
    }
  }
}

Response (not subscribed):

{
  "data": {
    "isSubscribedProductAlertStock": {
      "isSubscribed": false,
      "message": "You are not subscribed to this product."
    }
  }
}

Errors

Error
Description
Customer is not logged in.
The request does not include a valid customer authentication token.
Required parameter "sku" is missing.
The sku field was not provided in the input.
Unable to check if subscribed to stock alert. No such entity.
No product exists with the specified SKU.