This class represents a promotion in Commerce Cloud Digital. Examples of
promotions include:
“Get 20% off your order”
“$15 off a given product”
“free shipping for all orders over $50”
Get a bonus product with purchase of another product
The Promotion class provides access to the basic attributes of the promotion
such as name, callout message, and description, but the details of the
promotion rules are not available in the API due to their complexity.
Commerce Cloud Digital allows merchants to create a single logical “promotion
rule” (e.g. “Get 20% off your order”) and then assign it to one or more
“containers” where the supported container types are campaigns or AB-tests. A
Promotion represents a specific instance of a promotion rule assigned to a
container. Promotion rules themselves that are not assigned to any container
are inaccessible through the API. Each instance (i.e. assignment) can have
separate “qualifiers”. Qualifiers are the customer groups, source code
groups, or coupons that trigger a given promotion for a customer.
This method follows the same logic as getPromotionalPrice(Product) but prices are calculated based on the option values selected in the specified option model.
Returns the campaign this particular instance of the promotion is defined
in.
Note: If this promotion is defined as part of an AB-test, then a Campaign
object will be returned, but it is a mock implementation, and not a true
Campaign. This behavior is required for backwards compatibility and
should not be relied upon as it may change in future releases.
Returns the coupons directly assigned to the promotion or assigned to the campaign of the promotion.
If the promotion is not based on coupons (see isBasedOnCoupons()), or no coupons is assigned to the
promotion or its campaign, an empty collection is returned.
Returns the customer groups directly assigned to the promotion or assigned to the campaign of the promotion.
If the promotion is not based on customer groups (see isBasedOnCustomerGroups()), or no customer group is assigned to the
promotion or its campaign, an empty collection is returned.
Returns the effective end date of this instance of the promotion. If no
explicit end date is defined for the promotion, the end date of the
containing Campaign or AB-test is returned.
Returns the promotion's mutually exclusive Promotions. Mutually exclusive Promotions is a set of promotions or
groups this promotion cannot be combined with.
Returns the qualifier matching mode specified by this promotion. A
promotion may have up to 3 qualifier conditions based on whether it is
customer-group based, coupon based, and/or source-code based. A promotion
may require for example that a customer belong to a certain customer
group and also have a certain coupon in the cart in order for the
promotion to apply. This method returns QUALIFIER_MATCH_MODE_ALL if it is
necessary that all the qualifier conditions are satisfied in order for
this promotion to apply for a given customer. Otherwise, this method
returns QUALIFIER_MATCH_MODE_ANY indicating that at least of the
qualifier conditions must be satisfied.
Note: currently QUALIFIER_MATCH_MODE_ALL is only supported for promotions
assigned to campaigns, and not those assigned to AB-tests.
Returns the promotion's rank. Rank is a numeric attribute that you can specify.
Promotions with a defined rank are calculated before promotions without a defined rank.
If two promotions have a rank, the one with the lowest rank is calculated first.
For example, a promotion with rank 10 is calculated before one with rank 30.
Returns the source code groups directly assigned to the promotion or assigned to the campaign of the promotion.
If the promotion is not based on source code groups (see isBasedOnSourceCodes()), or no source code group is assigned to the
promotion or its campaign, an empty collection is returned.
Returns the effective start date of this instance of the promotion. If no
explicit start date is defined for this instance, the start date of the
containing Campaign or AB-test is returned.
Returns the promotion's tags. Tags are a way of categorizing and organizing promotions. A promotion can have many
tags. Tags will be returned in alphabetical order.
Returns the campaign this particular instance of the promotion is defined
in.
Note: If this promotion is defined as part of an AB-test, then a Campaign
object will be returned, but it is a mock implementation, and not a true
Campaign. This behavior is required for backwards compatibility and
should not be relied upon as it may change in future releases.
Returns the coupons directly assigned to the promotion or assigned to the campaign of the promotion.
If the promotion is not based on coupons (see isBasedOnCoupons()), or no coupons is assigned to the
promotion or its campaign, an empty collection is returned.
Returns:
Coupons assigned to promotion in no particular order.
Returns the customer groups directly assigned to the promotion or assigned to the campaign of the promotion.
If the promotion is not based on customer groups (see isBasedOnCustomerGroups()), or no customer group is assigned to the
promotion or its campaign, an empty collection is returned.
Returns:
Customer groups assigned to promotion in no particular order.
Returns the effective end date of this instance of the promotion. If no
explicit end date is defined for the promotion, the end date of the
containing Campaign or AB-test is returned.
Returns:
End date of the promotion, or null if no end date is defined.
Returns the promotion's mutually exclusive Promotions. Mutually exclusive Promotions is a set of promotions or
groups this promotion cannot be combined with.
Returns:
The promotion's set of mutually exclusive Promotions.
Returns the promotional price for the specified product. The promotional
price is only returned if the following conditions are met:
this promotion is a product promotion without purchase conditions, i.e. is of type 'Without qualifying products'.
this promotion's discount is Discount.TYPE_AMOUNT, Discount.TYPE_PERCENTAGE, Discount.TYPE_FIXED_PRICE, or Discount.TYPE_PRICEBOOK_PRICE.
specified product is one of the discounted products of the promotion.
the product has a valid sales price for quantity 1.0.
In all other cases, the method will return Money.NOT_AVAILABLE. It is
not required that this promotion be an active customer
promotion.
NOTE: the method might be extended in the future to support more
promotion types.
To calculate the promotional price, the method uses the current sales
price of the product for quantity 1.0, and applies the discount
associated with the promotion to this price. For example, if the product
price is $14.99, and the promotion discount is 10%, the method will
return $13.49. If the discount is $2 off, the method will return $12.99.
If the discount is $10.00 fixed price, the method will return $10.00.
Parameters:
product - the product to calculate the discount for
Returns:
the price of the passed product after promotional discount is
applied, or Money.NOT_AVAILABLE if any of the restrictions on
product or promotion are not met.
This method follows the same logic as
getPromotionalPrice(Product) but prices are calculated based
on the option values selected in the specified option model.
Parameters:
product - the product to calculate the discount for
optionModel - the option model to use when calculating
Returns:
the price of the passed product after promotional discount is
applied, or Money.NOT_AVAILABLE if any of the restrictions on
product or promotion are not met.
Returns the qualifier matching mode specified by this promotion. A
promotion may have up to 3 qualifier conditions based on whether it is
customer-group based, coupon based, and/or source-code based. A promotion
may require for example that a customer belong to a certain customer
group and also have a certain coupon in the cart in order for the
promotion to apply. This method returns QUALIFIER_MATCH_MODE_ALL if it is
necessary that all the qualifier conditions are satisfied in order for
this promotion to apply for a given customer. Otherwise, this method
returns QUALIFIER_MATCH_MODE_ANY indicating that at least of the
qualifier conditions must be satisfied.
Note: currently QUALIFIER_MATCH_MODE_ALL is only supported for promotions
assigned to campaigns, and not those assigned to AB-tests.
Returns:
the qualifier matching mode specified by this promotion, either
QUALIFIER_MATCH_MODE_ALL or QUALIFIER_MATCH_MODE_ANY.
Returns the promotion's rank. Rank is a numeric attribute that you can specify.
Promotions with a defined rank are calculated before promotions without a defined rank.
If two promotions have a rank, the one with the lowest rank is calculated first.
For example, a promotion with rank 10 is calculated before one with rank 30.
Returns the source code groups directly assigned to the promotion or assigned to the campaign of the promotion.
If the promotion is not based on source code groups (see isBasedOnSourceCodes()), or no source code group is assigned to the
promotion or its campaign, an empty collection is returned.
Returns:
Source code groups assigned to promotion in no particular order.
Returns the effective start date of this instance of the promotion. If no
explicit start date is defined for this instance, the start date of the
containing Campaign or AB-test is returned.
Returns:
Start date of the promotion, or null if no start date is defined.
Returns the promotion's tags. Tags are a way of categorizing and organizing promotions. A promotion can have many
tags. Tags will be returned in alphabetical order.