Undocumented order fields for graphQL api

New Member
2 0 0

Hi,

 

I'm working with an existing graphql query that contains some fields that are not available in the order documentation.

 

See for example:

 

query: """
{
orders(query: "created_at:>=2019-01-01") {
edges {
node {
id
referrerDisplayText
channel {
name
}
}
}
}
}
"""

 In this sample query we get fields `referrerDisplayText` and `channel.name` and that works well.

 

I went to the documentation to get more info about these fields: https://help.shopify.com/en/api/graphql-admin-api/reference/object/order however as you can those fields are not documented. For this reason I'm wondering where the guy that wrote this query found those fields, and whether or not it's safe to use it?

 

Thanks

0 Likes
Shopify Staff
Shopify Staff
106 19 22

Hey @souf ,

 

The reason why these two fields are no longer documented is because they have been deprecated, and are therefore no longer advised to be used. If you install the "Shopify GraphiQL App" onto your store from the app store, and tested your query out through this app, you would see the following messages:

 

`referredDisplayText` is deprecated, use `customerJourney.lastVisit.referralInfoHtml` instead.

 

`channel` is deprecated, use `publications` instead. 

 

With this in mind, your query should now look like this:

query: """
{
  orders(query: "created_at:>=2019-01-01") {
   edges {
     node {
        id
        customerJourney {
          lastVisit {
            referralInfoHtml
          }
        }
        publication {
          name
        }
      }
     }
   }
  }
}
"""

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
New Member
2 0 0

Thanks @hassain now I can see list of deprecated fields in the documentation. I have a concern about these specific fields however.

 

The doc says to use `customerJourney.lastVisit.referralInfoHtml` instead of `referredDisplayText`. However `lastVisit` data do not match and `firstVisit` looks to be the right one.

 

Regarding `Public.name` instead of `channel.name` it does not return exactly the same value. For urls Channel was returning domain name, when publication returns a full URL. Any recommendation on this one?

 

Thanks,

Soufiane

0 Likes
Shopify Staff
Shopify Staff
106 19 22

Hey @souf ,

 

The GraphQL objects of "Publication" and "Channel" should be functionally identical, so that is strange if you are seeing them return different results. 

 

From my understanding, the fields of "Publication.name" and "Channel.name" should return the name of the platform or marketplace (e.g. "Online Store", "Facebook", etc.) and not necessarily return a URL. However if you are noticing that "Publication.name" returns a full URL but "Channel.name" only return the domain name, you could write or leverage some code which could extract the domain name substring out of a full URL. There should be a lot of resources online and on StackOverflow to show you how to accomplish this. 

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes