diff --git a/src/pages/graphql/schema/product-alert/index.md b/src/pages/graphql/schema/product-alert/index.md new file mode 100644 index 000000000..f21768314 --- /dev/null +++ b/src/pages/graphql/schema/product-alert/index.md @@ -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. diff --git a/src/pages/graphql/schema/product-alert/mutations/index.md b/src/pages/graphql/schema/product-alert/mutations/index.md new file mode 100644 index 000000000..e22f3a9ed --- /dev/null +++ b/src/pages/graphql/schema/product-alert/mutations/index.md @@ -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. diff --git a/src/pages/graphql/schema/product-alert/mutations/subscribe-price.md b/src/pages/graphql/schema/product-alert/mutations/subscribe-price.md new file mode 100644 index 000000000..4317fae5c --- /dev/null +++ b/src/pages/graphql/schema/product-alert/mutations/subscribe-price.md @@ -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). + + + +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. | diff --git a/src/pages/graphql/schema/product-alert/mutations/subscribe-stock.md b/src/pages/graphql/schema/product-alert/mutations/subscribe-stock.md new file mode 100644 index 000000000..689c526c2 --- /dev/null +++ b/src/pages/graphql/schema/product-alert/mutations/subscribe-stock.md @@ -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). + + + +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. | diff --git a/src/pages/graphql/schema/product-alert/mutations/unsubscribe-price-all.md b/src/pages/graphql/schema/product-alert/mutations/unsubscribe-price-all.md new file mode 100644 index 000000000..3111db4e0 --- /dev/null +++ b/src/pages/graphql/schema/product-alert/mutations/unsubscribe-price-all.md @@ -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). + + + +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. | diff --git a/src/pages/graphql/schema/product-alert/mutations/unsubscribe-price.md b/src/pages/graphql/schema/product-alert/mutations/unsubscribe-price.md new file mode 100644 index 000000000..4b75aed40 --- /dev/null +++ b/src/pages/graphql/schema/product-alert/mutations/unsubscribe-price.md @@ -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). + + + +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. | diff --git a/src/pages/graphql/schema/product-alert/mutations/unsubscribe-stock-all.md b/src/pages/graphql/schema/product-alert/mutations/unsubscribe-stock-all.md new file mode 100644 index 000000000..cba79ef53 --- /dev/null +++ b/src/pages/graphql/schema/product-alert/mutations/unsubscribe-stock-all.md @@ -0,0 +1,68 @@ +--- +title: unsubscribeProductAlertStockAll mutation +description: The unsubscribeProductAlertStockAll mutation removes all of a logged-in customer's back-in-stock alert subscriptions. +--- + +# unsubscribeProductAlertStockAll mutation + +The `unsubscribeProductAlertStockAll` mutation removes all of the logged-in customer's back-in-stock alert subscriptions in a single operation. + +This mutation requires a valid [customer authentication token](../../customer/mutations/generate-token.md). + + + +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 { + unsubscribeProductAlertStockAll { + success + message + } +} +``` + +## Example usage + +The following example removes all back-in-stock alert subscriptions for the logged-in customer. + +**Request:** + +```graphql +mutation { + unsubscribeProductAlertStockAll { + success + message + } +} +``` + +**Response:** + +```json +{ + "data": { + "unsubscribeProductAlertStockAll": { + "success": true, + "message": "You will no longer receive stock 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. | diff --git a/src/pages/graphql/schema/product-alert/mutations/unsubscribe-stock.md b/src/pages/graphql/schema/product-alert/mutations/unsubscribe-stock.md new file mode 100644 index 000000000..d96045bc1 --- /dev/null +++ b/src/pages/graphql/schema/product-alert/mutations/unsubscribe-stock.md @@ -0,0 +1,78 @@ +--- +title: unsubscribeProductAlertStock mutation +description: The unsubscribeProductAlertStock mutation removes a logged-in customer's back-in-stock alert subscription for a product. +--- + +# unsubscribeProductAlertStock mutation + +The `unsubscribeProductAlertStock` mutation removes the logged-in customer's back-in-stock alert subscription for the specified product. + +This mutation requires a valid [customer authentication token](../../customer/mutations/generate-token.md). + + + +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 { + unsubscribeProductAlertStock(input: ProductAlertStockInput!) { + success + message + } +} +``` + +## Example usage + +The following example removes the logged-in customer's back-in-stock alert subscription for a product with SKU `MH01-XS-Black`. + +**Request:** + +```graphql +mutation { + unsubscribeProductAlertStock(input: { sku: "MH01-XS-Black" }) { + success + message + } +} +``` + +**Response:** + +```json +{ + "data": { + "unsubscribeProductAlertStock": { + "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 unsubscribe from back-in-stock 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. | diff --git a/src/pages/graphql/schema/product-alert/queries/index.md b/src/pages/graphql/schema/product-alert/queries/index.md new file mode 100644 index 000000000..3d60ec2e4 --- /dev/null +++ b/src/pages/graphql/schema/product-alert/queries/index.md @@ -0,0 +1,8 @@ +--- +title: Product alert queries +description: The product alert queries allow logged-in customers to check their current back-in-stock and price-drop alert subscriptions for products. +--- + +# Product alert queries + +The product alert queries allow logged-in customers to check their current back-in-stock and price-drop alert subscriptions for products. diff --git a/src/pages/graphql/schema/product-alert/queries/is-subscribed-price.md b/src/pages/graphql/schema/product-alert/queries/is-subscribed-price.md new file mode 100644 index 000000000..4c1077653 --- /dev/null +++ b/src/pages/graphql/schema/product-alert/queries/is-subscribed-price.md @@ -0,0 +1,78 @@ +--- +title: isSubscribedProductAlertPrice query +description: The isSubscribedProductAlertPrice query checks whether the logged-in customer is subscribed to a price-drop alert for a product. +--- + +# isSubscribedProductAlertPrice query + +The `isSubscribedProductAlertPrice` query returns whether the logged-in customer is currently subscribed to a price-drop alert for the specified product. + +This query requires a valid [customer authentication token](../../customer/mutations/generate-token.md). + + + +This query 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 +query { + isSubscribedProductAlertPrice(input: ProductAlertPriceInput!) { + isSubscribed + message + } +} +``` + +## Example usage + +The following example checks whether the logged-in customer is subscribed to a price-drop alert for a product with SKU `MH01-XS-Black`. + +**Request:** + +```graphql +query { + isSubscribedProductAlertPrice(input: { sku: "MH01-XS-Black" }) { + isSubscribed + message + } +} +``` + +**Response:** + +```json +{ + "data": { + "isSubscribedProductAlertPrice": { + "isSubscribed": false, + "message": "You are not subscribed to this product." + } + } +} +``` + +## Input attributes + +The `ProductAlertPriceInput` object contains the following attribute: + +| Attribute | Data type | Description | +| --- | --- | --- | +| `sku` | String! | The SKU of the product to check the price-drop alert subscription status for. | + +## Output attributes + +The `IsProductAlertSubscriptionResult` object contains the following attributes: + +| Attribute | Data type | Description | +| --- | --- | --- | +| `isSubscribed` | Boolean! | Indicates whether the customer is currently subscribed to a price-drop alert for the product. | +| `message` | String | A message describing the current subscription status. | + +## 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. | diff --git a/src/pages/graphql/schema/product-alert/queries/is-subscribed-stock.md b/src/pages/graphql/schema/product-alert/queries/is-subscribed-stock.md new file mode 100644 index 000000000..4a1c33dbe --- /dev/null +++ b/src/pages/graphql/schema/product-alert/queries/is-subscribed-stock.md @@ -0,0 +1,78 @@ +--- +title: isSubscribedProductAlertStock query +description: The isSubscribedProductAlertStock query checks whether the logged-in customer is subscribed to a back-in-stock alert for a product. +--- + +# isSubscribedProductAlertStock query + +The `isSubscribedProductAlertStock` query returns whether the logged-in customer is currently subscribed to a back-in-stock alert for the specified product. + +This query requires a valid [customer authentication token](../../customer/mutations/generate-token.md). + + + +This query 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 +query { + isSubscribedProductAlertStock(input: ProductAlertStockInput!) { + isSubscribed + message + } +} +``` + +## Example usage + +The following example checks whether the logged-in customer is subscribed to a back-in-stock alert for a product with SKU `MH01-XS-Black`. + +**Request:** + +```graphql +query { + isSubscribedProductAlertStock(input: { sku: "MH01-XS-Black" }) { + isSubscribed + message + } +} +``` + +**Response:** + +```json +{ + "data": { + "isSubscribedProductAlertStock": { + "isSubscribed": true, + "message": "You are already subscribed to this product." + } + } +} +``` + +## Input attributes + +The `ProductAlertStockInput` object contains the following attribute: + +| Attribute | Data type | Description | +| --- | --- | --- | +| `sku` | String! | The SKU of the product to check the back-in-stock alert subscription status for. | + +## Output attributes + +The `IsProductAlertSubscriptionResult` object contains the following attributes: + +| Attribute | Data type | Description | +| --- | --- | --- | +| `isSubscribed` | Boolean! | Indicates whether the customer is currently subscribed to a back-in-stock alert for the product. | +| `message` | String | A message describing the current subscription status. | + +## 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. |