Apply multiple discounts on order create through rest API

apopelka87
Visitor
1 0 4

Hi, we are currently migrating our e-commerce to Shopify and I'm working on historical order sync using REST API (the latest stable version) and NodeJS, some of our orders have up to 2 discounts applied but when I pass more than 1 discount code only the first one is applied to the order, for ex:

 

 

 

const shopifyOrder = new shopify.rest.Order({ session });

...

sOrder.discount_codes = [
          {
            code: "CODE_1",
            amount: "20",
            type: "fixed_amount",
          },
{
            code: "CODE_2",
            amount: "30",
            type: "fixed_amount",
          },
        ];

...

 

 

is it possible to create an order with more than one discount? thanks.

Replies 2 (2)

mattyonice
Shopify Partner
3 0 1

Having the same issue as you. Only the first discount code is applied when sending in an array of discount codes. 

 

Seems like a bug as the documentation clearly states we should be able to do this.

https://shopify.dev/docs/api/admin-rest/2024-01/resources/order#Createanorderandapplyadiscount

himanshu_agarwa
Shopify Partner
1 0 0

We're facing same problem, Let us know if you find a solution.