A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Currently I can't seem to find a field responsible for retrieving the B2B catalogs whitin the product data in the graphql admin api.
This is the Graphql query I'm using.
https://shopify.dev/docs/api/admin-graphql/unstable/objects/Product
Solved! Go to the solution
This is an accepted solution.
Hey @rafaelmarques , that's a great question.
When you're looking at the product resource, the B2B catalogues that the products are published on are going to be available in the publications.
An example query if you're looking to see if a product is available to a specific company, you can use publishedInContext
query Product {
product(id: "gid://shopify/Product/[ID]") {
publishedInContext(
context: { companyLocationId: "gid://shopify/CompanyLocation/[ID]" }
)
}
}
You can also use resourcePublicationsV2 to get the specific catalogs.
resourcePublicationsV2(catalogType: COMPANY_LOCATION, first: 15) {
nodes {
publication {
id
catalog {
id
}
}
}
}
Hope that helps!
- Kyle G.
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
This is an accepted solution.
Hey @rafaelmarques , that's a great question.
When you're looking at the product resource, the B2B catalogues that the products are published on are going to be available in the publications.
An example query if you're looking to see if a product is available to a specific company, you can use publishedInContext
query Product {
product(id: "gid://shopify/Product/[ID]") {
publishedInContext(
context: { companyLocationId: "gid://shopify/CompanyLocation/[ID]" }
)
}
}
You can also use resourcePublicationsV2 to get the specific catalogs.
resourcePublicationsV2(catalogType: COMPANY_LOCATION, first: 15) {
nodes {
publication {
id
catalog {
id
}
}
}
}
Hope that helps!
- Kyle G.
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
Worked perfectly. Thanks Kyle