---
updatedAt: 2026-09-18T08:03:40.000Z
agentTools:
  projectIndex: https://dev.superfans.io/llms.txt
---

# 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

```javascript
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

```javascript
await Superfans.actions.subscribeBackInStock();
```

### Best Practices

1. Show this CTA only when the current variant is unavailable.
2. Re-read `Superfans.variables.product` inside `onVariantChanged` before deciding whether to show the subscribe button.

### Caveats

1. This action uses the current product context; it does not accept a product or variant ID in the payload.
2. The user may need to be logged in or have notifications enabled depending on app configuration.