I'm a developer and one of our users asked for a feature to iterate through all sales channels similar as from the admin page (similar as shown in the below screenshot).
However, I couldn't find ways to retrieve this from the Orders API. It seems the "Order" object has "source_name" and "app_id" fields but they only have values within a fixed enum set ("web" and "shopify_draft_order"). Anyone knows if there's a way to get the "real" sales channel of an order or it's still not a live feature yet? Thanks!
Solved! Go to the solution
If you look at the Shopify GraphQL API reference (https://shopify.dev/docs/admin-api/graphql/reference/object/order?api[version]=2020-07) you will see a publication field. This should link back to the sales channel that brought in the order I believe.
As for the REST API endpoint for orders, the app_id has hard-coded integer values that translate to the sales channel that the order was created through. Actually in the Shopify web admin, you can filter orders by sales channel and see the app_id values in the URL. These app_id values don't change once the shop has installed the sales channels. See below.
If this doesn't suffice, hopefully the GraphQL route will automatically perform the mapping as to the real sales channel names...
Look at my screen shot I provided up above. It shows in the Shopify web admin where if I select a sales channel in the GUI, the ID appears in the URL in the address bar. That's a quick way to map which ID goes with which sales channel name. While you might be able to get at this programmatically using the GraphQL API or something, if you don't have a lot of sales channels and since the ID mappings don't change, this is a quick and easy way to do this
Hi @Greg_Kujawa sorry I didn't make my question clear. I meant would it be possible to give a simple GraphQL example for this? Since I'm an app developer it's not quite likely to access our user's admin dashboard to read ID-name mappings of their sales channels.