Custom Discount applied to cart not reflecting in order detail of swell dashboard

Hi, We are using our own custom discount logic to apply discounts. We are updating discounts in the cart. discount is successfully applied to the cart and the user paid the discounted price.

On the swell dashboard, cart is showing discount cart URL is

but once this same cart is converted to order, the user paid the grand_total (which includes discount) of the cart, which is correct.

but on the order detail of the swell dashboard discount is not mentioned. the total amount is shown on the order also doesn’t include the discount. Order URL is

ideally, discounts should be shown on both order detail and cart.

I'm attaching the screenshots on both cart and order created from the same cart.

As you can see in the images, the total on the cart is not equal to the total on order.


  • even though the discount isn't needed on all of the line items in the cart, I'd still recommend spreading out the total discount on the line items, in order to preserve the existing discount logic.

    Alternatively, if the discount really cannot be set at the item level, you can update the formula for how theΒ discount_totalΒ is calculated, using a custom field of your choosing:

    PUT /:models/carts/fields/discount_total

    {"$set": {Β "formula": "item_discount + custom_discount"Β }}

    Now, when you set the custom_discount field on the cart, it will be included in the discount_total and grand_total calculations, alongside regular discounts.

    Hope this helps!

    I'm using the above solution which was recommended by @Greg in an earlier didiscussion.

  • Hi Mohit,

    Alex from our team mentioned that he already mentioned through email that we need an improvement for this. He already created an improvement regarding this.

  • Hi Jesse,

    Yes, he said an improvement is needed on this. on the reply to the same email I asked for the ETA for the same. never got any reply on that. we also have to prioritize things according to the same ETA, we can't just wait for an indefinite time.

  • Hi any update on this?

  • Greg
    edited February 23

    Hi @Mohit saraswat ,

    To confirm, you're looking to carry over a 'custom_discount' field correct? Essentially, field formulas can be defined on the order model which reference custom fields on the cart. When a cart is then converted to an order, those formulas will auto-run, copying over the desired fields. Here's how that might look:

    1. Define custom field and formula on the order model:
    PUT /:models/orders/fields
     "custom_discount": {
        "type": "currency",
        "formula": "cart.custom_discount",
    2. Programmatically set the custom field on cart as normal
    "custom_discount": 120.10
    3. When the cart is converted to an order, the custom field(s) should carry over correctly. This setup can be replicated for as many fields as needed.

  • Mohit saraswat
    edited February 25

    @Greg thank you for this modification. earlier you told me to make similar changes to the cart model

    PUT /:models/carts/fields/discount_total

    {"$set": {Β "formula": "item_discount + custom_discount"Β }}

    do we need to combine the above with the current order model changes PUT /:models/orders/fields
     "custom_discount": {
        "type": "currency",
        "formula": "cart.custom_discount",

    or only changing the order model will solve our problem?

  • Hi @Greg I've tried this on our test account (

    I have updated both cart and order models as you instructed. now custom_discount field is being propagated to orders but it is not considered in the grand_total.

    cart_id-> 6218a92a445ad40132d779ce

    order_id -> 6218ac02445ad40132dc9962

    same problem has occurred this time too. discount is being added to cart, but not reflecting in orders

Sign In or Register to comment.