Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

GraphQL API - How to retrieve the status of a company?

GraphQL API - How to retrieve the status of a company?

mariounkel
Visitor
2 0 0

Hi, 

 

I'm new to Shopify and I'm working on the GraphQL APIs. I'm looking for a way to get all Companies info for Approved Companies. Or more specifically, where a customer is approved for ordering. Or at least looking for a way to distinguish their status. I haven't been able to understand where to see this through the Graph APIs.

 

mariounkel_0-1706188413217.png

 

 

Any pointers would be greatly appreciated.

 

Thanks you

Replies 2 (2)

ShopifyDevSup
Shopify Staff
1453 239 535

Hi @mariounkel,

 

The Company object in GraphQL doesn't have an "Approved" field, but our guide on creating companies mentions that "A companyContact must be added to create orders and draft orders."

 

The companies query can be used to retrieve a list of your store's companies, and their contactRoles connection could also be used to determine their eligibility for making orders.

 

Hope that helps!

 

- James

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

mariounkel
Visitor
2 0 0

Hi, 

 

Thanks for your answer. Yes I found the link. This gave me the info I was looking for. And with this I will filter out the companies that have a least 1 role assignment. 

query MyQuery {
  companies(first: 10) {
    edges {
      node {
        id
        name
        externalId
        locations(first: 1) {
          edges {
            node {
              name
              roleAssignments(first: 10) {
                edges {
                  node {
                    role {
                      name
                    }
                  }
                }
              }
            }
          }
        }
        contacts(first: 10, query: "isMainContact:true") {
          edges {
            node {
              isMainContact
              id
              customer {
                email
                multipassIdentifier
              }
            }
          }
        }
      }
    }
  }
}