Showing posts with label Promotions. Show all posts
Showing posts with label Promotions. Show all posts

ATG Order Reprice and How it works?

When Order reprice is typically called?
The Order is typically repriced after the following actions: 
  • Item is added to the cart 
  • Item is removed from the cart 
  • Quantity is changed on items in the cart 
  • User specifies a shipping address or shipping method and pushes "Checkout" button
How to do repricing on Order?
Use /atg/commerce/order/purchase/RepriceOrderDroplet to invoke repricing on order:



How it works behind the scenes?
Each time the code reprices the order, the ATG Promotions associated with the user's Profile are considered.
  • Fetch all of the Promotions/Discounts that the user is eligible for:
    • (Global + Individual Promotions) minus Promotions they don't qualify for
  • Calculate the price of each individual item on the order
    • Apply Item Level Discounts
  • Calculate the order total price(discounted item prices + shipping price)
    • Apply Order Level discounts
  • Calculate the shipping price
    • Apply Shipping Discounts
  • Generate a total price
Few scenarios when Order reprice is not working:
If you don't see your order getting repriced as you expected (the discount isn't being related), these are some things to check on:
  • Was the repricing code called yet?
  • Was the Promotion successfully added to the Profile?
  • Was the Promotion represented correctly in the repository?  
 

ATG - Promotions 101

What is Promotion?
A Promotion is an item created in the BCC that contains information about a possible discount that some (or all) users on your site may be able to get. Promotions specify a discount amount, and a conditional rule.

There are two types of Promotions:
 1) Global 

  • Automatically granted to all users
  •  If order qualifies, discount is given
 2) Individual 
  • Not automatically granted to all users
  • Something (typically a Scenario) has to grant the Promotion to the user before they can get the discount
What happens at User "Profile" component level?
  • When a user comes to your site, ATG will create a "Profile" component for this user. 
  • This ATG Profile component sticks around for the entire user session. It goes away when the user terminates their session. 
  • This Profile contains a property called "activePromotions" – this is a list of 0 or more Promotions that this user has been given. 
  • Each time your order is repriced, the code looks in Profile.activePromotions plus all Global Promotions to see which promotions the user is eligible for and reprices the order accordingly.

 How a user gets promotion(s)?
  •  If you create a Global Promotion, all users will automatically be given the Promotion (remember: they may not qualify – but it is always in their list of "possible promotions")
  •  If you create an Individual Promotion, the associated Promotion must first be "given" to the user. If the Individual Promotion is not in the Profile.activePromotions property, the user will not get the discount even if they qualify.
  • If a Scenario adds a Promotion to the user's Profile.activePromotions property, but the user doesn't actually qualify for it, a discount will not be given when the order is repriced
There are a number of ways Individual Promotions can be granted to the user. 
Commonly used one's are:
  1. Scenarios   -  Create a Scenario such as: If order.total is >= 50$, give user promotion: 10Off50, or if user logs in, and Profile.age > 62 and today is Wednesday, then give user a 20SeniorWednesday promotion 
  2. Coupons - User enters a coupon code associated with Promotion 10Off50. The Promotion is added to Profile.activePromotions