Try our conversational search powered by Generative AI!

Report Coupon/Voucher usage


How Can I retrieve the following Information about coupons/vouchers?

Coupons have been redeemed.

Order Number where the coupon was redeemed.

I am on Latest Commerce Version.

Aug 05, 2021 13:46

Hi Khan,

The coupon code does exist for the save PO in OrderFormEx.

SELECT * FROM OrderFormEx where Epi_CouponCodes  IS NOT NULL 

So we can retrieve the PO + Coupon Codes with this way:

var pos = _orderRepository.Load<IPurchaseOrder>(CustomerContext.Current.CurrentContactId);
var couponsWithOrders = new Dictionary<string, string>();
foreach (var po in pos)
    List<string> couponList = new List<string>();
    foreach (var form in po.Forms)
    couponsWithOrders.Add(po.OrderNumber, string.Join(",", couponList.Select(x=>x)?.ToList()));
Aug 05, 2021 14:58

I am quite sure this is one of the recipe in my second book that you purchased :)

Aug 05, 2021 19:49


It was the very custom thing I guess,
IContentLoader, IPromotionService and PromotionInformationRepository helped, but I had to record Coupon Usages my self

Edited, Aug 09, 2021 15:09
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.