Retrieve the B2B catalogs assigned to a product using the Admin Grpahql API

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

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.
1 Like

Worked perfectly. Thanks Kyle