Solved

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

rafaelmarques
Tourist
10 0 2

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 57 70

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 57 70

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 2

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 2

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