GraphQL Filtering Orders by sales_channel

I’m trying to filter orders by date and sales channel with GraphQL. When I omit the field sales_channel from the query I get the orders on the date specified the number of which matches that expected. However, when I include the sales_channel field I get 4 orders which is far from the expected number of ~150. I’m using the GraphQL query below with admin API 2021-04

{
  orders(query: "processed_at:=2019-07-06 sales_channel:Point of Sale") {
    edges {
      cursor
      node {
        id
      }
    }
    pageInfo {
      hasNextPage
    }
  }
}

What am I missing here? The 4 orders returned don’t appear to differ in any way from the other POS orders that day.

Thanks for the help!

Hey @BradKrane ,

After some digging I wasn’t able to locate sales_channel as a confirmed query parameter specifically. However in the Order resource documentation the source_name property can return pos as a parameter (as well as web, shopify_draft_order, iphone, and android) I might suggest retrying the query but instead filtering by this property, and have included an example below as a starting point!

  • Cheers!
{
  orders(first: 150 query: "processed_at:2019-07-06 source_name:pos") {
    edges {
      cursor
      node {
        id
        processedAt
        publication {
          name
        }
      }
    }
    pageInfo {
      hasNextPage
    }
  }
}

@awwdam That does the trick, thanks!

sales_channel is listed as a supported filter parameter of orders in the GraphiQL explorer. I was guessing a value as there is little available in the doc about all the supported filters in the Orders API doc

Looking to do the same thing, I stumbled across this question. I found sales channel is also listed as a filter in the documentation here: https://shopify.dev/api/admin-graphql/2022-01/queries/orders#argument-orders-query

Additionally, sales_channel is used in the admin portal when filtering by “App”, e.g. sales_channel:"580111" is apparently “Online store” while sales_channel:"129785" is “POS” for the store I’m looking at. A bit fishy that it’s used and documented, but not enough to be usable.

How did you find the numeric value of the sales channel? Im not seeing the sales channel values.

If you select one of the sales channel filters:

you should be able to see the URL update accordingly:

few_meaning_1-1648565781915.png

Or you can inspect the HTML:

Thanks for the reply. I was able to find it. Have you experience no results returned when only using the numerical value as the source name?

“source_name” in the GraphQL API is not the numerical value, it’s the “name” (the words). See https://community.shopify.com/c/shopify-apis-and-sdks/get-order-s-sales-channel-name/td-p/324784 for some more context.

Ahh thanks, looks like I need to create some sort of mapping since the 3rd party sale channels don’t have names. Thanks for your help