Discount Eligibility Not Working

I've setup a discount where a 20% discount is applied for items whose price exceeds $100.00

This works just fine.

However, if I define an eligibility requirement (discount eligibility tab) for a specific user based on their email, and I log into the website as that user, the discount does NOT get applied.

Am I missing something



Answer this question

Discount Eligibility Not Working

  • daniel mark

    Are you using the Starter Site It should be wired up by default. If not, make sure you add the user object profile to the basket pipeline before running it. This should look something like:

    using (PipelineInfo pipeline = new PipelineInfo("basket", OrderPipelineType.Basket))
    {
    if (CommerceContext.Current.UserProfile != null)
    {
    pipeline.Profiles.Add(
    "UserObject", CommerceContext.Current.UserProfile);
    }
    }

    Hope this helps.

    -David


  • smgorden

    I have done the same.

    Working with Local User Object.E-mail Is equal to

    //Johan



  • kreativ

    I've experienced this same problem, but have not had the time to look into it.

    I assumed that I had not properly configured that User Object for the Content Selection Framework.


    I'll be waiting to hear the solution.



  • kmazur

    David, thanks for your input. Yes, I am using the Starter Site. Just in case, I added the code you supplied above.

    Again, the goal is to target a specified user via the discount eligibility tab. According to CS documentation, this is where target expressions can be used to define "who" the discount applies to. The following is an excerpt from the documentation:

    Use the Discount Properties screen, Eligibility tab, to specify to whom the discount will apply. Eligibility requirements are target expressions. If the target expression evaluates to "True" Commerce Server applies the discount.

    So far I haven't been successful when specifying eligibility. Discounts work if I don't specify any eligibility -- but as soon as I enter an eligibility to target a specific user [User Object.E-mail Is equal to johndoe@john.com] for example, discounts aren't applied (even when johndoe@john.com is the current user).

    I will continue researching this as time allows.


  • drmcl

    All right, looks like I was wrong.

    The Starter Site DOES apply discounts when using eligibility to target the user's email. The reason it wasn't working before was that other [approved] discounts I created may have superseded the eligibility-discount that I thought wasn't working.

    For testing, I un-approved all discounts except for the eligibility one, and that's how I discovered it actually does work.

    To really check things out, I next tried setting eligibility to check for the user's organization. So, instead of [User Object.E-mail Is equal to johndoe@john.com], I changed it to [Organization.Name Is equal to MyOrganization]. At first, the discount stopped working again. But, after plugging in David's code using "Organization" instead:

    using (PipelineInfo pipeline = new PipelineInfo("basket", OrderPipelineType.Basket))
    {
    if (CommerceContext.Current.UserProfile != null)
    {
    pipeline.Profiles.Add("Organization", CommerceContext.Current.OrganizationProfile);
    }
    }

    The discount was correctly applied.

    Thanks again David.


  • Discount Eligibility Not Working