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

subscribeProductAlertPrice mutation

The subscribeProductAlertPrice mutation subscribes the logged-in customer to a price drop alert for the specified product. When the product price decreases, the customer receives an email notification.

This mutation requires a valid customer authentication token.

Syntax

mutation {
  subscribeProductAlertPrice(
    input: ProductAlertPriceInput!
  ): ProductAlertSubscriptionResult
}

Reference

The subscribeProductAlertPrice reference provides detailed information about the types and fields defined in this mutation.

Example usage

The following example subscribes the logged-in customer to a price alert for the product with SKU ADB112.

Request:

mutation {
  subscribeProductAlertPrice(
    input: { sku: "ADB112" }
  ) {
    success
    message
  }
}

Response:

{
  "data": {
    "subscribeProductAlertPrice": {
      "success": true,
      "message": "You saved the alert subscription."
    }
  }
}

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 subscribe to price alert. No such entity.
No product exists with the specified SKU.
Unable to subscribe to price alert
An internal error occurred while creating the subscription.