Promotion APIs for A/B Testing

You can use the Salesforce B2C Commerce APIs for when a promotion is assigned to an A/B test and not to a campaign. These classes return a placeholder campaign, representing A/B tests, for API methods that return or process a campaign instance, when an A/B test (not a campaign) is in effect.

The method Promotion.getCampaign.getCustom isn’t accessible when a promotion is assigned to an A/B test and not a campaign. The method returns an empty map because this object isn't derived from an extensible object. The method promotions.campaign is a dummy object, which is an instance of dw/object/ExtensibleObject.java. When the method promotions.campaign.custom is called, the getCustom method on dw/object/ExtensibleObject.java is called and returns the “ExtensibleObjectAttributes id“ value. When a promotion or price adjustment is the result of an A/B test, the method Promotion.getCampaign.getID() always returns AB Testing.

When a promotion or price adjustment is the result of an A/B test, these methods return the following:

With this method... Returns...
Promotion.getCampaign placeholder campaign
Promotion.getCoupons empty collection
Promotion.getCustomerGroups empty collection
Promotion.getSourceCodeGroups empty collection
Promotion.isBasedOnCoupon false
Promotion.isBasedOnCoupons false
Promotion.isBasedOnCustomerGroups false
Promotion.isBasedOnSourceCodes false
PriceAdjustment.getCampaign placeholder campaign
PriceAdjustment.getCampaignID ID of placeholder campaign
PriceAdjustment.getCouponLineItem null
PriceAdjustment.isBasedOnCampaign true
PriceAdjustment.isBasedOnCoupon false

Related Links

APIs for Promotions

A/B Testing

The B2C Commerce API documentation

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.