thirdandgrove / gatsby-source-bigcommerce Goto Github PK
View Code? Open in Web Editor NEWGatsby source plugin that makes Big Commerce api data available
Gatsby source plugin that makes Big Commerce api data available
Building nodes seems to skip array objects.
Eg. a product node should have images
of type array[object]
(see
https://developer.bigcommerce.com/api-reference/catalog/catalog-api/products/getproducts) but on GraphiQL that field is not present
When developing with this plugin activated and a gatsby v3 site, I get the following warnings:
warn Plugin gatsby-source-bigcommerce is not compatible with your gatsby version 3.10.1 - It requires gatsby@^2.0.0
warn Plugin gatsby-source-bigcommerce is not compatible with your gatsby version 3.10.1 - It requires gatsby@^2.0.0
Hey,
Thanks for taking the time to build this. I'm having trouble getting this to work.
I have configured as per the readme, but for some reason, it's not pulling in any data. allBigCommerceNode is not visible is the graphiQl interface.
Do you know the best way to debug this?
Cheers
Using the endpoint /catalog/products?include=modifiers
causes BigCommerce to limit the API response to 10 entries and, in a store with more than 10 entries, the extra pages are never loaded.
Also, inspecting the code I noticed that the same would happen in a store with more than 50 items on the catalog.
Also, there is a bug on BC API where they cut the number of entries from 50 to 10 but they do not update the meta.pagination response. It looks like the following:
"meta": {
"pagination": {
"total": 30,
"count": 10,
"per_page": 50,
"current_page": 1,
"total_pages": 1,
"links": {
"current": "?include=modifiers&page=1&limit=50"
},
"too_many": false
}
}
This can be solved by adding the correct limit to the API call, for example /catalog/products?include=modifiers&limit=10, in which case the response becomes:
"meta": {
"pagination": {
"total": 30,
"count": 10,
"per_page": 10,
"current_page": 1,
"total_pages": 3,
"links": {
"next": "?include=modifiers&limit=10&page=2",
"current": "?include=modifiers&limit=10&page=1"
},
"too_many": false
}
}
I'll try something but can't promise a fix.
Cheers!
Do you think that there will be any support for gatsby images?
I tried implementing this myself but I'm not super familiar with creating nodes in gatsby.
Gatsby needs to collect all the data from the source for correct GraphQL work (including sorting and filtering). Current implementation returns 50 items at most because BigCommerce API designed this way. For collecting the next portion of the data (next 50 items) from BigCommerce, an additional ?page=${nextPageNumber}
query parameter needs to be added to the API request.
This change is required for projects that have in BigCommerce more than 50 items in products, categories, product variants, etc. in order to be able to build a Gatsby site with the correct amount of data retrieved from BigCommerce.
I've done the following on current plugin implementation:
{
resolve: 'gatsby-source-bigcommerce',
options: {
...
endpoints: {
BigCommerceCategories: "/catalog/categories",
}
}
},
query AllCategories {
allBigCommerceCategories {
totalCount
}
}
Response with only 50 items:
{
"data": {
"allBigCommerceCategories": {
"totalCount": 50
}
}
}
Get count of all my BigCommerce categories:
{
"data": {
"allBigCommerceCategories": {
"totalCount": 1024
}
}
}
I've created Pull Request: #18
Thanks for all of your work on gatsby-source-bigcommerce
! I've been using it for a few days now and found it to be very helpful.
I'm just now looking into BigCommerce's GraphQL API, which is currently in BETA. It looks like it's going to be able to provide a ton of useful things like product imagery and in-depth site data, etc.
In order to use the BigCommerce GraphQL API and integrate it into Gatsby's GraphQL, you have to generate a storefront token and then use something gatsby-source-graphql
.
I'm wondering if you have put any thought into BigCommerce's GraphQL API and how it might affect gatsby-source-bigcommerce
. It seems like they could co-exist if gatsby-source-bigcommerce can handle generating the Storefront API token. Not sure if that is something that you would want to pursue though. Thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.