Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

Get products based on catalogs that are assigned to a company location ID

Solved

Get products based on catalogs that are assigned to a company location ID

rafaelmarques
Tourist
10 0 3

When a Location is assigned to a Catalog in Shopify
The ability to get the products associated to the Location's catalog

Accepted Solution (1)

lizk
Shopify Staff
246 58 78

This is an accepted solution.

 

Hi there 👋

Would a query similar to the following be sufficient?

{
  catalogs(first: 10 query:"company_location_id:<location id>"){
    nodes {
      id
      publication {
        products(first: 20) {
          nodes {
            id
            handle
          }
        }
      }
    }
  }
}


You can review the catalog documentation here. 

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 3 (3)

lizk
Shopify Staff
246 58 78

This is an accepted solution.

 

Hi there 👋

Would a query similar to the following be sufficient?

{
  catalogs(first: 10 query:"company_location_id:<location id>"){
    nodes {
      id
      publication {
        products(first: 20) {
          nodes {
            id
            handle
          }
        }
      }
    }
  }
}


You can review the catalog documentation here. 

To learn more visit the Shopify Help Center or the Community Blog.

rafaelmarques
Tourist
10 0 3

Hi, thanks for replying.

 

I tried exactly like this but for some reason it's always returning 0 even having records.

rafaelmarques
Tourist
10 0 3

I guess it worked. I tried removing the "gid://shopify/CompanyLocation" from string.
I'll do some testing and return to mark the solution as accepted. Thanks