CommercePromotions Class

Evaluate promotions for Commerce orders. Get coupon code redemption usage.

ConnectApi

These methods are for CommercePromotions. All methods are static.

Don’t write an Apex test that calls these CommercePromotions APIs within the context of a guest.

  • decreaseRedemption(couponCodeRedemption)

    Get coupon code redemption usage to revert a previously redeemed coupon code.

  • evaluate(salesTransaction)

    Determine which promotions the customer is eligible for based on the store and buyer group, and compute the applicable price adjustments based on the coupons and the items in the cart. This API evaluates only the first 50 active manual promotions and first 50 active automatic promotions, based on priority. This API computes and returns applicable price adjustments, but it does not apply those adjustments to the webcart record. If you want to enable promotions based on shipping, contact Salesforce Customer Support.

  • increaseRedemption(couponCodeRedemption)

    Get coupon code redemption addition (increase) usage.

Get coupon code redemption usage to revert a previously redeemed coupon code.

58.0

58.0

No

public static ConnectApi.CouponCodeRedemptionCollection decreaseRedemption(ConnectApi.CouponCodeRedemptionInput couponCodeRedemption)

couponCodeRedemption

Type: ConnectApi.CouponCodeRedemptionInput

Tracks each coupon code redemption.

Type: ConnectApi.CouponCodeRedemptionCollection

Determine which promotions the customer is eligible for based on the store and buyer group, and compute the applicable price adjustments based on the coupons and the items in the cart. This API evaluates only the first 50 active manual promotions and first 50 active automatic promotions, based on priority. This API computes and returns applicable price adjustments, but it does not apply those adjustments to the webcart record. If you want to enable promotions based on shipping, contact Salesforce Customer Support.

57.0

57.0

No

global static ConnectApi.PromotionEvaluation evaluate(ConnectApi.PromotionEvaluateInput salesTransaction)

salesTransaction

Type: ConnectApi.PromotionEvaluateInput

Find promotions that the customer is eligible for and compute their discounts.

Type: ConnectApi.PromotionEvaluation

Get coupon code redemption addition (increase) usage.

58.0

58.0

No

public static ConnectApi.CouponCodeRedemptionCollection increaseRedemption(ConnectApi.CouponCodeRedemptionInput couponCodeRedemption)

couponCodeRedemption

Type: ConnectApi.CouponCodeRedemptionInput

Tracks each coupon code redemption.

Type: ConnectApi.CouponCodeRedemptionCollection