Implement Search, Filter, & Sort for Tier Pricing Listings with Shopify GraphQL Admin API

Hey Shopify devs,

We have a combined listing for tier pricing—data is stored as metafields on both products and variants. We fetch both types using Admin GraphQL queries, then merge and display in our app. Now we want to add search, filter, and sorting (e.g. by product name A→Z), and need this entirely on Shopify’s Admin API (no server-side custom code), scaling to large catalogs.

Here’s how we handle this:

  • Use title and other built-in product/variant attributes for search and filter right in the query.

  • Use sortKey: TITLE and reverse for A→Z/Z→A sorting.

  • For filtering by metafield (tier pricing rules), make sure metafields are indexed so they’re searchable via query.

  • Pagination (first, after, hasNextPage, endCursor) works great for handling thousands of items.

Has anyone successfully filtered by metafields on large data sets, or found advanced techniques for this using only the GraphQL Admin API? Tips or example queries appreciated!

Product query:
query ($cursor: String) {

        products(first: 100, after: $cursor) {

          pageInfo {

            hasNextPage

            endCursor

          }

          edges {

            node {

              id

              title

              handle

              metafield(namespace: "product", key: "test") {

                value

              }

            }

          }

        }

      }

ProductVariant query:
query ($cursor: String) {

        productVariants(first: 100, after: $cursor) {

          pageInfo {

            hasNextPage

            endCursor

          }

          edges {

            node {

              id

              title

              product {

                id

                title

              }

              metafield(namespace: "variant", key: "test") {

                value

              }

            }

          }

        }

      }

    `;

Would love to hear best practices from the community!


Hey @Shrutika_Lokhande, have you considered using the storefront API for this?

Hello @KyleG-Shopify,

But we wanted to display the list on the admin and storefront API is used for frontend purpose

Ah, sorry I missed that part. Looking at what you have proposed, it should work well. Are you running in to issues with your current iteration, or moreso working on preparing for handling large catalogs?