Subscribe Back In Stock
Subscribes the current user to back-in-stock alerts for the selected product.
Description
The subscribeBackInStock() action subscribes the current customer to a back-in-stock notification for the product currently in context.
Function Signature
await Superfans.actions.subscribeBackInStock();| Parameter | Type | Required | Description |
|---|---|---|---|
| Nil | Nil | Nil | This action does not require any parameter. The SDK uses the current product and variant context. |
Structure of Response
| Status | Response |
|---|---|
| Success | { "status": "success", "message": "Back in stock subscription created successfully" } |
| Unexpected Error | { "status": "error", "errorId": 500, "errorHandle": "unknown-error", "message": "Something unexpected happened" } |
Example Usage
await Superfans.actions.subscribeBackInStock();Best Practices
- Show this CTA only when the current variant is unavailable.
- Re-read
Superfans.variables.productinsideonVariantChangedbefore deciding whether to show the subscribe button.
Caveats
- This action uses the current product context; it does not accept a product or variant ID in the payload.
- The user may need to be logged in or have notifications enabled depending on app configuration.
Updated about 7 hours ago
Did this page help you?