Promotion Enhancements
Published by DJ Steinmetz on January 20, 2023
Introducing new enhancements to increase flexibility of OrderCloud Promotions.
New Properties
AutoApply
, defaultfalse
This new property enables customers to designate promotions as
AutoApply
, and set varying numericPriority
values which dictate the order in which promotions are automatically applied.
Active
, defaulttrue
Promotions where
Active = false
will not be evaluated for either the.../applypromotions
or.../eligiblepromotions
endpoints, and will never be returned fromv1/me/promotions
. Designating a promotionActive = false
prevents a buyer user from accessing the promotion, without deleting the record from your marketplace.A newly deactivated promotion will also be removed from any Unsubmitted orders immediately following deactivation. The promotion data will remain accessible from the administrative endpoints, making for a good historical record, or for possible reactivation in the future.
Priority
, nullableThe new
Priority
property on Promotions can be used to control the order in which promotions are applied when callingv1/orders/{direction}/{orderID}/applypromotions
/v1/cart/applypromotions
. There are no rules around the sequencing ofPriority
values.
New Endpoints
v1/orders/{direction}/{orderID}/eligiblepromotions
andv1/cart/eligiblepromotions
The new endpoints enable listing eligible promotions for an order. This capability can support features such as displaying eligible promo codes to the buyer user during checkout, and many other UI driven promotion-based enhancements.
v1/orders/{direction}/{orderID}/applypromotions
andv1/cart/applypromotions
When you have a number of promotions designated as AutoApply, whenever you want to attempt to apply these promotions to an order, you call the new respective endpoint above. This will fetch all eligible promotions where
AutoApply = true
, sorted byPriority
and attempt to apply them to the order one by one. Promotions wherePriority = null
will be evaluated last. The Order model is then returned from this call, enabling the developer to display the newPromotionDiscount
in the UI. The maximum number of promotions that will be applied to an order in a single API call is 100.Similarly to other promotions, auto applied promotions are never automatically removed from an order. You must use the order validate endpoint in order to determine which promotions are no longer eligible, and then call to remove those promotions.
Still have questions?
Ask in our Community Channel