MarketingService will remove all discounts in the step called ApplyAwards which is executed in the basket pipeline. You need to remove that step from the basket pipeline. After that i believe everything will run as expected. Your code seems fine.
You can attach the discount to one or more order lines to make that work. Here's some code:
var discount = new Discount(); order.AddDiscount(discount); var orderline = order.OrderLines.First(); orderline.AddDiscount(discount); discount.AddOrderLine(orderline);
Hi Søren, Thanks, the problem with the orderline discount is, it can only be seen in the basket. What I need is a product discount the user can see before it's added to the basket and present it in a productlist or on the product detail page. I can see now that my description/need is not clear enough, sorry for that.
Sounds like a need a bit more background on what you need to happen :)
Meanwhile, here's my assumption: You need to display an offer, but not an actual product to the customer. If that's correct here's ho wyou'd go about making that happen.
product discount through the API
Hi how can I apply a discount to a product through the API?
I know how to add a discount to an order, like this
var discAmount = ((((order.OrderTotal) / 100) * 10));
var dis = new UCommerce.EntitiesV2.Discount { AmountOffTotal = (decimal)(discAmount / 100) * 80 };
order.AddDiscount(dis);
TransactionLibrary.ExecuteBasketPipeline();
Any code samples on how to apply discount on a product, would be highly appreciated.
I am runnnig the free version
Hello Kim,
MarketingService will remove all discounts in the step called ApplyAwards which is executed in the basket pipeline. You need to remove that step from the basket pipeline. After that i believe everything will run as expected. Your code seems fine.
Best regards
Morten
Hi Morten, thanks I already did that and the order discount works fine, but that was not my question :)
I need to make a product discount (not order discount) throug the API?
Hi Kim,
You can attach the discount to one or more order lines to make that work. Here's some code:
Hi Søren,
Thanks, the problem with the orderline discount is, it can only be seen in the basket. What I need is a product discount the user can see before it's added to the basket and present it in a productlist or on the product detail page. I can see now that my description/need is not clear enough, sorry for that.
Hi Kim,
Sounds like a need a bit more background on what you need to happen :)
Meanwhile, here's my assumption: You need to display an offer, but not an actual product to the customer. If that's correct here's ho wyou'd go about making that happen.
Marketing Foundation has three key pieces to it: Advertise, Act, and Award. It sounds to me like you need the first bit. You can read more about advertising with Marketing Foundation on the docs site.
Also you might find the general docs for Marketing Foundation helpful.
Hope this helps and please let me know if you need anything else.
is working on a reply...