Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/pages/graphql/schema/product-alert/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Product alerts
description: Use product alert mutations and queries to manage stock and price alert subscriptions for logged-in customers.
---

# Product alerts

Product alerts allow logged-in customers to subscribe to receive notifications when a product's price drops or when an out-of-stock product becomes available again.

These mutations and queries require a valid [customer authentication token](../customer/mutations/generate-token.md).

## Mutations

- [subscribeProductAlertStock mutation](mutations/subscribe-stock.md) — Subscribe to a back-in-stock alert for a product.
- [unsubscribeProductAlertStock mutation](mutations/unsubscribe-stock.md) — Unsubscribe from a back-in-stock alert for a product.
- [unsubscribeProductAlertStockAll mutation](mutations/unsubscribe-stock-all.md) — Unsubscribe from all back-in-stock alerts.
- [subscribeProductAlertPrice mutation](mutations/subscribe-price.md) — Subscribe to a price-drop alert for a product.
- [unsubscribeProductAlertPrice mutation](mutations/unsubscribe-price.md) — Unsubscribe from a price-drop alert for a product.
- [unsubscribeProductAlertPriceAll mutation](mutations/unsubscribe-price-all.md) — Unsubscribe from all price-drop alerts.

## Queries

- [isSubscribedProductAlertStock query](queries/is-subscribed-stock.md) — Check whether the logged-in customer is subscribed to a back-in-stock alert for a product.
- [isSubscribedProductAlertPrice query](queries/is-subscribed-price.md) — Check whether the logged-in customer is subscribed to a price-drop alert for a product.

## Prerequisites

Product alerts must be enabled in the Admin before these operations are available:

- **Stores** > **Configuration** > **Catalog** > **Product Alerts** > **Allow Alert When Product Price Changes** — enables price alerts.
- **Stores** > **Configuration** > **Catalog** > **Product Alerts** > **Allow Alert When Product Comes Back in Stock** — enables stock alerts.
8 changes: 8 additions & 0 deletions src/pages/graphql/schema/product-alert/mutations/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Product alert mutations
description: The product alert mutations allow logged-in customers to subscribe to and unsubscribe from back-in-stock and price-drop alerts for products.
---

# Product alert mutations

The product alert mutations allow logged-in customers to subscribe to and unsubscribe from back-in-stock and price-drop alerts for products.
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: subscribeProductAlertPrice mutation
description: The subscribeProductAlertPrice mutation subscribes a logged-in customer to a price-drop alert for a product.
---

# subscribeProductAlertPrice mutation

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

This mutation requires a valid [customer authentication token](../../customer/mutations/generate-token.md).

<InlineAlert variant="info" slots="text1" />

This mutation is part of the Storefront Compatibility Package and is only available on [Adobe Commerce as a Cloud Service](https://experienceleague.adobe.com/en/docs/commerce/cloud-service/overview) and [PaaS(With ACO License)](https://experienceleague.adobe.com/en/docs/commerce/optimizer/get-started).

## Syntax

```graphql
mutation {
subscribeProductAlertPrice(input: ProductAlertPriceInput!) {
success
message
}
}
```

## Example usage

The following example subscribes the logged-in customer to a price-drop alert for a product with SKU `MH01-XS-Black`.

**Request:**

```graphql
mutation {
subscribeProductAlertPrice(input: { sku: "MH01-XS-Black" }) {
success
message
}
}
```

**Response:**

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

## Input attributes

The `ProductAlertPriceInput` object contains the following attribute:

| Attribute | Data type | Description |
| --- | --- | --- |
| `sku` | String! | The SKU of the product to subscribe to price-drop alerts for. |

## Output attributes

The `ProductAlertSubscriptionResult` object contains the following attributes:

| Attribute | Data type | Description |
| --- | --- | --- |
| `success` | Boolean! | Indicates whether the subscription was successful. |
| `message` | String | A message describing the result of the subscription action. |

## Errors

| Error | Description |
| --- | --- |
| `Customer is not logged in.` | The request did not include a valid customer authentication token. |
| `Required parameter "sku" is missing.` | The `sku` field was not provided in the input. |
| `Product with SKU "%1" does not exist.` | No product was found matching the provided SKU. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: subscribeProductAlertStock mutation
description: The subscribeProductAlertStock mutation subscribes a logged-in customer to a back-in-stock alert for a product.
---

# subscribeProductAlertStock mutation

The `subscribeProductAlertStock` mutation subscribes the logged-in customer to a back-in-stock alert for the specified product. When the product becomes available, the customer receives an email notification.

This mutation requires a valid [customer authentication token](../../customer/mutations/generate-token.md).

<InlineAlert variant="info" slots="text1" />

This mutation is part of the Storefront Compatibility Package and is only available on [Adobe Commerce as a Cloud Service](https://experienceleague.adobe.com/en/docs/commerce/cloud-service/overview) and [PaaS(With ACO License)](https://experienceleague.adobe.com/en/docs/commerce/optimizer/get-started).

## Syntax

```graphql
mutation {
subscribeProductAlertStock(input: ProductAlertStockInput!) {
success
message
}
}
```

## Example usage

The following example subscribes the logged-in customer to a back-in-stock alert for a product with SKU `MH01-XS-Black`.

**Request:**

```graphql
mutation {
subscribeProductAlertStock(input: { sku: "MH01-XS-Black" }) {
success
message
}
}
```

**Response:**

```json
{
"data": {
"subscribeProductAlertStock": {
"success": true,
"message": "You saved the alert subscription."
}
}
}
```

## Input attributes

The `ProductAlertStockInput` object contains the following attribute:

| Attribute | Data type | Description |
| --- | --- | --- |
| `sku` | String! | The SKU of the product to subscribe to back-in-stock alerts for. |

## Output attributes

The `ProductAlertSubscriptionResult` object contains the following attributes:

| Attribute | Data type | Description |
| --- | --- | --- |
| `success` | Boolean! | Indicates whether the subscription was successful. |
| `message` | String | A message describing the result of the subscription action. |

## Errors

| Error | Description |
| --- | --- |
| `Customer is not logged in.` | The request did not include a valid customer authentication token. |
| `Required parameter "sku" is missing.` | The `sku` field was not provided in the input. |
| `Product with SKU "%1" does not exist.` | No product was found matching the provided SKU. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: unsubscribeProductAlertPriceAll mutation
description: The unsubscribeProductAlertPriceAll mutation removes all of a logged-in customer's price-drop alert subscriptions.
---

# unsubscribeProductAlertPriceAll mutation

The `unsubscribeProductAlertPriceAll` mutation removes all of the logged-in customer's price-drop alert subscriptions in a single operation.

This mutation requires a valid [customer authentication token](../../customer/mutations/generate-token.md).

<InlineAlert variant="info" slots="text1" />

This mutation is part of the Storefront Compatibility Package and is only available on [Adobe Commerce as a Cloud Service](https://experienceleague.adobe.com/en/docs/commerce/cloud-service/overview) and [PaaS(With ACO License)](https://experienceleague.adobe.com/en/docs/commerce/optimizer/get-started).

## Syntax

```graphql
mutation {
unsubscribeProductAlertPriceAll {
success
message
}
}
```

## Example usage

The following example removes all price-drop alert subscriptions for the logged-in customer.

**Request:**

```graphql
mutation {
unsubscribeProductAlertPriceAll {
success
message
}
}
```

**Response:**

```json
{
"data": {
"unsubscribeProductAlertPriceAll": {
"success": true,
"message": "You will no longer receive price alerts."
}
}
}
```

## Output attributes

The `ProductAlertSubscriptionResult` object contains the following attributes:

| Attribute | Data type | Description |
| --- | --- | --- |
| `success` | Boolean! | Indicates whether the operation was successful. |
| `message` | String | A message describing the result of the operation. |

## Errors

| Error | Description |
| --- | --- |
| `Customer is not logged in.` | The request did not include a valid customer authentication token. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: unsubscribeProductAlertPrice mutation
description: The unsubscribeProductAlertPrice mutation removes a logged-in customer's price-drop alert subscription for a product.
---

# unsubscribeProductAlertPrice mutation

The `unsubscribeProductAlertPrice` mutation removes the logged-in customer's price-drop alert subscription for the specified product.

This mutation requires a valid [customer authentication token](../../customer/mutations/generate-token.md).

<InlineAlert variant="info" slots="text1" />

This mutation is part of the Storefront Compatibility Package and is only available on [Adobe Commerce as a Cloud Service](https://experienceleague.adobe.com/en/docs/commerce/cloud-service/overview) and [PaaS(With ACO License)](https://experienceleague.adobe.com/en/docs/commerce/optimizer/get-started).

## Syntax

```graphql
mutation {
unsubscribeProductAlertPrice(input: ProductAlertPriceInput!) {
success
message
}
}
```

## Example usage

The following example removes the logged-in customer's price-drop alert subscription for a product with SKU `MH01-XS-Black`.

**Request:**

```graphql
mutation {
unsubscribeProductAlertPrice(input: { sku: "MH01-XS-Black" }) {
success
message
}
}
```

**Response:**

```json
{
"data": {
"unsubscribeProductAlertPrice": {
"success": true,
"message": "You saved the alert subscription."
}
}
}
```

## Input attributes

The `ProductAlertPriceInput` object contains the following attribute:

| Attribute | Data type | Description |
| --- | --- | --- |
| `sku` | String! | The SKU of the product to unsubscribe from price-drop alerts for. |

## Output attributes

The `ProductAlertSubscriptionResult` object contains the following attributes:

| Attribute | Data type | Description |
| --- | --- | --- |
| `success` | Boolean! | Indicates whether the unsubscription was successful. |
| `message` | String | A message describing the result of the unsubscription action. |

## Errors

| Error | Description |
| --- | --- |
| `Customer is not logged in.` | The request did not include a valid customer authentication token. |
| `Required parameter "sku" is missing.` | The `sku` field was not provided in the input. |
| `Product with SKU "%1" does not exist.` | No product was found matching the provided SKU. |
Loading
Loading