SubscribeCustomer
Description
Subscribes an e-mail address to newsletter subscriptions.
Operation name: subscribeCustomer.
The mutation supports:
- first-time subscription
- already-subscribed response
- reactivation of previously unsubscribed record
Endpoint
mutation subscribeCustomer($email: String!) {
subscribeCustomer(email: $email) {
success
message
subscribedEmail
alreadyExists
wasReactivated
}
}
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
| String | Yes | Subscriber e-mail address. |
Return Values
Returns CustomerSubscription:
| Field | Type | Description |
|---|---|---|
| success | Boolean | Whether operation completed successfully. |
| message | String | Human-readable result message. |
| subscribedEmail | String | E-mail that was processed. |
| alreadyExists | Boolean | Whether subscriber already existed. |
| wasReactivated | Boolean | Whether existing unsubscribed record was reactivated. |
Usage Example
mutation {
subscribeCustomer(email: "customer@example.com") {
success
message
alreadyExists
wasReactivated
}
}
Notes
- Plugin setting
customerSubscriptionEnabledmust be enabled. - Empty/invalid email input throws a customer error.