Try our conversational search powered by Generative AI!

Get Promotions applied to a lineItem

Vote:
 

Hi team,

          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.

Thanks.

#207968
Oct 09, 2019 14:46
Vote:
 

Hi Akshaya,

Can you debug and confirm the values you are passing to the Evaluate() method are not null?

Like contentLink or Market etc.

#207969
Oct 09, 2019 15:05
Akshaya - Oct 09, 2019 15:25
No Praful Jangid , there are no null parameters. All the other promotions are obtained, except the promotion that has customer redemption.
Vote:
 

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?

#207970
Oct 09, 2019 15:12
Akshaya - Oct 09, 2019 15:25
Yeah i have logged in as that Customer only
Vote:
 

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)

#207975
Oct 09, 2019 15:32
Vote:
 

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....

https://www.avensia.com/joel-yourstone/why-isnt-my-promotion-showing/

#207976
Oct 09, 2019 15:34
Vote:
 

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. 

#207977
Oct 09, 2019 15:37
Vote:
 

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

#207980
Oct 09, 2019 15:53
Vote:
 

It really sounds like the customer is not authenticated somehow...

  1. Are you running this from a scheduled job?
  2. Can you remove the customer redemption limit and get the promotion redeemed?
  3. Can you add a customer redemption limit to a working promotion to see it not be eligible anymore?

Otherwise, can you post the callstack of where you call Evaluate, maybe that can give some hints...

#207982
Oct 09, 2019 16:43
Akshaya - Oct 09, 2019 16:53
1. Yes we are using Customized schedule Jobs.
2. Yes it is redemed.
3. yes, it becomes not eligible after adding customer redemption.
The number of orders placed is less than the customer redemptions.
Vote:
 

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.

#207989
Oct 09, 2019 20:13
Akshaya - Oct 10, 2019 9:37
Let me be more clear Joel Yourstone , the promotions are applied to the line item in the cart . I need to display the available promotion Names for that line item so when I use this method

var allPromotions = promotionEngine.Evaluate(contentLink, currentMarket.GetCurrentMarket(), Currency.USD, RequestFulfillmentStatus.PartiallyFulfilled | RequestFulfillmentStatus.Fulfilled);

The promotions associated to that line Item are not obtained. And they are not obtained only when customer redemptions are set.

And in the above I mentioned that the promotions are added to the backend through job. But this process is done in the cart page as an authenticated user only.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.