How to apply a single discount to an entire order line in Shopify?

EusebioTrigo
Shopify Partner
1 0 0

I am building an integration from a Point of Sale to import orders into Shopify through a custom app.

 

I'm now handling the case of discounts, and first, I need to aggregate all the discounts applied to an order line, which is... fine, but will not handle the case of several discounts applied to a single order line.

 

But to the point: when I send through the Graphql Admin API a draftOrder with their order lines, and with a discount of on one order line like:

 

 

 

line_items [
  {
    originalUnitPrice: 2,
    quantity: 4,
    taxable: true,
    title: 'Title',
    variantId: 'gid://shopify/ProductVariant/WHATEVER',
    appliedDiscount: {
      amount: 1.4,
      value: 1.4,
      title: 'Applied discount at POS',
      valueType: 'FIXED_AMOUNT'
    }
  }
]

 

 

The discount is applied for each one of the items, so if a customer buys for at the shop, in Shopify it is reflected to have a discount per each one of the order lines.

 

EusebioTrigo_0-1708949940965.png

 

Is this expected? How can we send just a discount affecting the order line and not each one of the items, dividing the discount by the number of items?

 

Replies 0 (0)