Line items cannot be sorted, schema suggests they could be

Regardless of the ‘sort’ argument supplied, the line items will always be sorted by legacy_id in an order’s LineItemConnection. Are we using the query wrong, or is this feature not implemented?

query {
  order(id: "T****************3") {
    data {
      line_items(sort: "price") {
        edges {
          node {
            price
            legacy_id
          }
        }
      }
    }
  }
}

EDIT: I just noticed that in the example I provided, one could consider line items to be sorted by their price alphabetically, but this is completely coincidental and is just due to my failure to pick a more neutral example. Another example query (request_id: 62f3c90f67470bcbdf7cfded) returns:

"line_items": {
          "edges": [
            {
              "node": {
                "price": "25.0000",
                "legacy_id": 7*****073
              }
            },
            {
              "node": {
                "price": "6.0000",
                "legacy_id": 7*****074
              }
            },
            {
              "node": {
                "price": "45.0000",
                "legacy_id": 7*****075
              }
            },
            {
              "node": {
                "price": "4.0000",
                "legacy_id": 7*****076
              }
            },
            {
              "node": {
                "price": "2.0000",
                "legacy_id": 7*****077
              }
            },
            {
              "node": {
                "price": "94.0000",
                "legacy_id": 7*****078
              }
            },
            {
              "node": {
                "price": "12.0000",
                "legacy_id": 7*****895
              }
            }
          ]
        }

Hello @Gergely!

Welcome to our Public API Community, glad to have you here!

Wanted to let you know I started investigating this matter and will let you know as soon as i have an update!

Have a nice day!
TomasFD

1 Like

Hello @Gergely!

I’m forwarding the issue to our engineers as there seems to be a bug preventing the sort from working correctly in that connection.

Have a great day!
TomasFD

Hi @tomasfd!

Thank you for the update!

Do you have an ETA on when this bugfix will be shipped? We need to know whether we need to look at workarounds in the meantime.

Have a great day!
Gergely

Hey @Gergely,

Good news!
The Engineers are currently working on this ticket as we speak. I suspect a fix to be rolled out soon. I’ll let you know when that happens.

Thank you for your continued patience.

Best,
RayanP

1 Like