A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
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)
{
couponList.AddRange(form.CouponCodes);
}
couponsWithOrders.Add(po.OrderNumber, string.Join(",", couponList.Select(x=>x)?.ToList()));
}
I am quite sure this is one of the recipe in my second book that you purchased :)
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.