ConsentStatusEntry
MarketingConsentSubscription
ShopperConsentErrorCodes
ShopperConsentException
ShopperConsentMgr
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Provides static helper methods for managing shopper marketing consent subscriptions.
This API enables retrieving and updating marketing consent preferences. Consent subscriptions define communication categories (e.g., “Newsletter”, “Product Updates”) and the channels (EMAIL, SMS, WHATSAPP) through which marketing communications can be sent.
Prerequisites:
Example usage:
1var ShopperConsentMgr = require('dw/customer/consent/ShopperConsentMgr');
2
3// Get all subscriptions for the current site
4var subscriptions = ShopperConsentMgr.getSubscriptions();
5
6for each (var sub in subscriptions) {
7 trace('Subscription: ' + sub.subscriptionId + ' - ' + sub.title);
8 trace('Available channels: ' + sub.channels.join(', '));
9}
10
11// Get subscriptions with consent status (for authenticated customers)
12var subsWithStatus = ShopperConsentMgr.getSubscriptions(null, true);
13
14// Update consent for a specific subscription
15ShopperConsentMgr.updateSubscription(
16 'customer@example.com',
17 'newsletter-subscription',
18 'EMAIL',
19 'OPT_IN'
20);See Also:
| Property | Description |
|---|---|
subscriptions: Collection (read-only) | Retrieves marketing consent subscriptions for the current site. |
This class does not have a constructor, so you cannot create it directly.
| Method | Description |
|---|---|
| static getSubscriptions() | Retrieves marketing consent subscriptions for the current site. |
| static getSubscriptions(List, Boolean) | Retrieves marketing consent subscriptions for the current site with optional filtering and status. |
| static updateSubscription(String, String, String, String) | Updates consent status for a subscription. |
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
(read-only)Retrieves marketing consent subscriptions for the current site.
This method returns all available consent subscriptions without consent status information.
Retrieves marketing consent subscriptions for the current site.
This method returns all available consent subscriptions without consent status information.
Returns:
Throws:
Retrieves marketing consent subscriptions for the current site with optional filtering and status.
Use this method to retrieve subscriptions filtered by tags and optionally include the current consent status for authenticated customers.
Parameters:
Returns:
Throws:
Updates consent status for a subscription.
This method updates the consent status in Salesforce Core for the specified contact point and subscription channel combination.
Parameters:
Throws: