Hello everyone, I’m looking for a way to associate a company location with a price catalog using the GraphQL API. I haven’t found any information on this topic. Can you help me? Thanks in advance.
Topic summary
Goal: Associate a company location with a B2B catalog via the Admin GraphQL API and link a price list.
How to proceed:
- Create or update a catalog and include the company location ID in the context field (catalogCreate/catalogUpdate). Then associate a price list to the catalog.
- To add specific locations without dropping others, use catalogContextUpdate. Be aware: these mutations behave as a SET.
Important nuance:
- Passing a single location ID to catalogUpdate replaces existing locations on the catalog. You must provide the full list of location IDs each time you update.
Limits and constraints:
- Max 250 location IDs can be sent per mutation call.
- No bulk operation exists in the UI or API to assign a catalog to more than 250 locations at once.
Workarounds:
- First query the current location IDs, then send the entire merged list to append.
- Use Shopify Flow to loop through locations and add the catalog one-by-one (Flow has a query limit of 100, so handle pagination).
Status: No official bulk support yet; workaround-based, open issue. Image provided but not essential.
Hey @Ggarret , you can create and associate a catalog with a company location by passing the company location ID in the context field of the catalogCreate or catalogUpdate mutation.
Once you have that, you can assign a price list to a catalog. https://shopify.dev/docs/apps/b2b/catalogs#step-1-associate-a-price-list-with-the-catalog
Hope that helps,
- Kyle G.
If you want to add individual locations to a catalog you might want to look at the catalogContextUpdate mutation:
https://shopify.dev/docs/api/admin-graphql/2024-04/mutations/catalogContextUpdate
If you just pass in one location ID to the catalogUpdate mutation you’re going to remove it from other locations it was assigned to.
This is a great call out. What support neglects to mention in this case is that assigning the catalog to a company location (or rather adding the location to the catalog) is a SET when using the catalogCreate and catalogUpdate along with the catalogContextUpdate mutations. Meaning you have to provide the entire list of location ids when calling that endpoint. So if you intend to append a location to a catalog, you must query the current list first and send it all back up. But watch out, as you can only send a list of 250 or less…
In our case, we needed to add a catalog to many companies, well over 250 locations. Unfortunately there is no way through the UI or through the APIs to do this it seems. Hopefully bulk operations will be available to us someday.
We were able to work around this by using Flow, which can iterate a location query result and add the catalog one by one. You have to finesse your way through this as it also has a query limit, of 100.
