To obtain promotions available for a particular lineItem, we used the following code
var allPromotions = promotionEngine.Evaluate(contentLink, currentMarket.GetCurrentMarket(), Currency.USD, RequestFulfillmentStatus.PartiallyFulfilled | RequestFulfillmentStatus.Fulfilled);
When the redemption limits are set to the Customer, the available promotions are not obtained. I have set the redemption limit as 5 and the number of orders placed to that order is 2 and still I am not able to obtain the promotions that are applied to a lineItem.
Can you debug and confirm the values you are passing to the Evaluate() method are not null?
Like contentLink or Market etc.
The customer must be logged in to get these promotions, if you have set any Customer redemption limit. Are you logged in while trying to obtain the promotion?
What is your current market value?And, if you filer by current market in Commerce Manager do you see any promotion? Like in below image I have selected Illinios and unselect the default. (If your market is diffenent)
Aight, then start checking with the common cases I guess 😅. I have a blog post which outlines some of them, that I have fallen into myself a lot....
Nice work Joel,
That's really helpful :) That includes debugging steps.
Hi Akshaya, please follow this blog (posted by Joel) and let us know if you still don't find answer.
Yesh i have followed the above steps, but all the other order promotions CanbeFulfilled method are hit. Except the entry promotion that has customer redemptions
It really sounds like the customer is not authenticated somehow...
Otherwise, can you post the callstack of where you call Evaluate, maybe that can give some hints...
Then there is your answer. You are running it through a scheduled job, which does not have the same HttpContext as the customer itself (i.e. the customer can never "be logged in" in a background job).
As far as I know there isn't any really smooth way of resolving that, running promotions for a specific user, without having to fake the user being logged in in the scheduled job.