Order_create mutation multiple line_items

Hi,

I’m just starting to learn GraphQL and following the schema documentation has been very helpful. I can create an order using the order_create mutation as long as only 1 line item exists. How do I put in more than 1 line_items in the mutation? I use Insomnia and the editor keeps warning me about not allowing duplicates inside the line_items object.

Hello @sdwelrn! To add multiple line items you can use the following structure, using some test data from my account:

      line_items: [
        {
          product_name: "FUJIFILM XF 16-55mm f/2.8 R LM WR Lens"
          sku: "FU165528"
          partner_line_item_id: "45645365436"
          quantity: 1
          price: "1199.00"
        }
        {
          product_name: "FUJIFILM XF 16-55mm f/2.8 R LM WR Lens"
          sku: "FU165528"
          partner_line_item_id: "4564536546636"
          quantity: 1
          price: "999.00"
        }
      ]

Curly brackets for each line item inside square brackets for an array is how it’s done. You can have 2 of the same SKU, which we don’t recommend unless they differ in price. Each line item must have its own partner_line_item_id

I hope this helps! Let me know if you have further questions!

1 Like

@tomasfd Thank you for the explanation and sample code. Regarding the partner_line_item_id, is that an unique id for the order or is it unique across the account?

Hey @sdwelrn we check the uniqueness of that field per account+shop_name. As the field might be repeatable in different store integrations. Best!

1 Like

Thank you, all my questions have been answered.

1 Like