Try our conversational search powered by Generative AI!

New Promotions: How to set cupon code on a cart and line items in the cart.


I wanted to use coupons for the cart and line items in the cart. I am looking at documentation: :

If set, a matching coupon code must be supplied for the order, or the promotion is not applied.

But I am unable to find any description how to "supply coupon code for the order".

Tried to add it "old" way by adding OrderFormDiscount on OrderForm:

orderForm.Discounts.Add(new OrderFormDiscount {DiscountCode = cuponCode});

But it didn't have any effect.

Aug 01, 2016 15:32

You should be using:


orderForm has to be IOrderForm,



Aug 01, 2016 15:56

Thanks Quan!

P.S. Documentation needs to be updated.

Aug 01, 2016 16:18

Documentation updated -- Thanks Maris!

Aug 01, 2016 17:57

I have same problem with discount code.

I have written the code in this form

  var OrderForm = (IOrderForm)cart.OrderForms[0];

The cupon code is not visible in commerce manager .

It is showing none

Feb 21, 2017 14:32

Coupon codes are visible in CM only if discount is applied by this code. Otherwise the code gets removed.

Feb 21, 2017 14:40

Another thing, is there any relation between (discount code ,shipment)  and with this code

                PurchaseOrder POChek = OrderContext.Current.GetPurchaseOrder(orderNumber);
                PurchaseOrder POChek12 = OrderStatusManager.HoldOrder(POChek);

When i am using this code the discount code is being visible.

But if i remove this code the code is not being visible.

Feb 21, 2017 14:44

I don't think they are related. However, as a general rule, you should not try to mix APIs - the old (concrete classes) with the new ones (abstraction interfaces). That can result in some unexpected behavior. We recommend that from the time you load an order to the time you save it, you should only use only kind of APIs.

Also, the older version of Commerce Manager has some limitation regarding support the new promotion system and the new abstraction APIs. I would suggest to upgrade to the latest one (10.3) instead.

Feb 21, 2017 16:22
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.