[gatsby-source-shopify] — Limit products in ShopifyCollection
See original GitHub issueSummary
Wouldn’t it be great to limit the number of products pulled in when querying a collection in the gatsby-source-shopify plugin? This would reduce the size of the generated page-data.json files, making page load and prefetching even faster.
Basic example
myCollection: shopifyCollection(handle: { eq: "kitchen" }) {
handle
products(limit: 18) {
edges {
node {
id
}
}
}
}
Motivation
Speed. And thrift.
Right now the plugin pulls in all the products in a collection. Say you only want to tease a collection by showing two or three products on a shop overview page and give the user the option to drill deeper. Right now i get rather largish page-data.json files that include all the queried data, although i will never use it.
We could do the same for images as well. Sometimes i don’t need more than one image of a product or category.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
gatsby-source-shopify-incremental
Currently only products and collections are incrementally fetched. I have plans to support pages, blogs, and articles as well but they are lower...
Read more >How does salesChannel work? I want to filter products that are ...
Basically, I have several different sites, each using a private app to limit each site's "inventory" to just the inventory that is specified...
Read more >Query multiple collections from Shopify in GatsbyJS
I want to display groups of Shopify products based on what collections they're associated with, using gatsby-source-shopify.
Read more >Headless Shopify: Lessons Learned Building with Gatsby, Part 2
A “document” is an instance of a type (e.g., my type is “Product” and my document is “Blue Dress”). Gatsby has a source...
Read more >GraphQL Storefront API - Shopify.dev
The API offers a full range of commerce options making it possible for customers to view products and collections, add products to a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As an aside, it would be nice to have generic resolvers that allowed limit, sort, skip, etc. on array values. Something like a
@listOperators
directive:Something like that could benefit other source plugins.
I got this to work using this