Copied to clipboard

Flag this post as spam?

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

These support forums are now closed for new topics and comments.
Please head on over to for support.

  • Kim Søjborg Pedersen 71 posts 275 karma points
    Apr 08, 2015 @ 09:03
    Kim Søjborg Pedersen

    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 };

    Any code samples on how to apply discount on a product, would be highly appreciated.

    I am runnnig the free version 

  • Morten Skjoldager 440 posts 1499 karma points
    Apr 08, 2015 @ 10:17
    Morten Skjoldager

    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


  • Kim Søjborg Pedersen 71 posts 275 karma points
    Apr 08, 2015 @ 10:26
    Kim Søjborg Pedersen

    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? 


  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 14, 2015 @ 13:14
    Søren Spelling Lund

    Hi Kim,

    You can attach the discount to one or more order lines to make that work. Here's some code:

    var discount = new Discount();
    var orderline = order.OrderLines.First();
  • Kim Søjborg Pedersen 71 posts 275 karma points
    Apr 14, 2015 @ 17:28
    Kim Søjborg Pedersen

    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.



  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 21, 2015 @ 13:04
    Søren Spelling Lund

    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.

Please Sign in or register to post replies

Write your reply to: