Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
We are looking to implement the new B2B site, however we are noticing the new company ID and companyLocation ID's are not being passed on the payload for the orders create webhook. After some time looking through the graphQL orders query, we are unable to find how to get the companyLocation ID, was successful in getting the Company ID through companyContactProfiles/company.
Does anyone know how we can get the companyLocation ID either through the order graphQL query, or an alternative way through graphQL?
thanks.
Solved! Go to the solution
This is an accepted solution.
Found the solution to find the companyLocationID for a specific order using GraphQL:
query MyQuery {
order(id: "gid://shopify/Order/%orderID%") {
id
name
poNumber
discountCode
customer {
companyContactProfiles {
company {
id
name
externalId
}
}
}
purchasingEntity {
... on PurchasingCompany {
__typename
location {
id
name
externalId
}
}
}
}
}
Hi Hepworthd,
The companyLocation object has a field for ID - can you use the company ID that you have retrieved from the order to make a call to the company
object, which has a Company.locations connection and from there get the companyLocation ID?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me 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
I don't think this would work since we have many locations under a company. The only solution I found was to re-call the order using the orders API, this then gives the company ID, and companyLocation ID.
This is an accepted solution.
Found the solution to find the companyLocationID for a specific order using GraphQL:
query MyQuery {
order(id: "gid://shopify/Order/%orderID%") {
id
name
poNumber
discountCode
customer {
companyContactProfiles {
company {
id
name
externalId
}
}
}
purchasingEntity {
... on PurchasingCompany {
__typename
location {
id
name
externalId
}
}
}
}
}
Glad you figured this out Hepworthd and thanks for coming back to post the answer!
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me 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