Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • iiii 15 posts 154 karma points
    Sep 11, 2017 @ 10:58
    iiii
    0

    [discount coupons] List available coupons

    Hello,

    It's possible to have access to all available coupons (through the code) ?

    Thank you

  • William Zhang 39 posts 242 karma points
    Sep 13, 2017 @ 17:29
    William Zhang
    0

    You can get all active coupons from OfferSettingsService, which is exposed through the MerchelloContext:

    MerchelloContext.Current.Services.OfferSettingsService.GetAllActive();
    
  • iiii 15 posts 154 karma points
    Sep 14, 2017 @ 13:58
    iiii
    0

    Hello,

    Thanks for your reply, Ive done that but it returns an empty list.. and I have one active coupon.

    when I use MerchelloContext.Current.Services.OfferSettingsService.GetByOfferCode("40SUMMER") it finds and returns that coupon.

    enter image description here

    Do you have any idea why is it not working?

    Does that function gets all active coupons or only the ones being applied to the current basket?

    Thank you!

  • William Zhang 39 posts 242 karma points
    Sep 14, 2017 @ 14:10
    William Zhang
    0

    The GetAllActive() method takes an optional parameter excludeExpired that defaults to true. Try setting it to false if you want to get all active offers regardless of expiration status.

    And yes, it gets all active offers, not just the ones being applied :)

  • iiii 15 posts 154 karma points
    Sep 15, 2017 @ 14:13
    iiii
    0

    thank you but it doesnt work :( it's still empty..

Please Sign in or register to post replies

Write your reply to:

Draft