-
Notifications
You must be signed in to change notification settings - Fork 100
Woocommerce: filters work on some products but not others #103
Comments
This could potentially be something to do with the product type. It seems like variable products can be queried but simple products cannot. |
Interesting, this definitely seems like a bug. Are you able to share a /graphql endpoint that has this issue so I can debug? Thanks! |
Hi @TylerBarnes, can use the same endpoint I've emailed you previously :) |
@TylerBarnes @mattdabell Any progress on this one? I suddenly experience a similar issue despite everything working well before. I think this happened when turning my variable products into simple ones. In fact, filters do not work at all on any of my simple products. To spice things up, it turns out WP GraphiQL (WordPress) only lists 10 out of the 27 (non filtered) products, whereas GraphiQL (Gatsby/Localhost) lists all 27 of them. However, if I then filter on a product slug (or any other argument), I do get the expected result from WP GraphiQL (WordPress), but an empty array from GraphiQL (Gatsby/Localhost). Using See screenshots below. GraphiQL (Gatsby/Localhost) |
I don't think there's any progress yet. I agree it definitely seems related to variable products, but something weird is going on for sure. I managed to work around the issue by up-front querying for every single product in gatsby-node then injecting the relevant products into the different taxonomy pages via context, basically using JS to filter instead of page queries & graphql. It works fine for now but I imagine breaks incremental builds & previews etc so hoping to refactor back to the normal way once things have stabilised. |
Thanks for the input @mattdabell. I've made another check now and filtering works for variable products, but not for simple products. I have not tried grouped or external products. If the bug is within WoographQl or gatsby-source-wordpress-experimental is hard for me to say. @TylerBarnes What's your take on this? |
Thanks for the additional context @HumidBrains . The Woo schema is set up in a way this plugin isn't expecting so some additional logic needs to be added. Since we don't technically support Woo in this plugin just yet, I'm scoping this for after stable release. However, I am going to take a quick peek and see if this is a simple fix. If it is I'll cut a release soon. |
Hey Yall, I just had a look at this using @mattdabell 's API and I couldn't reproduce. I wonder if this was a Gatsby core bug that got fixed. What version of Gatsby are you on? @HumidBrains can you run @mattdabell I can access that product by id: @HumidBrains I'm able to filter by slug no problem as well. |
If it's not a Gatsby core bug that's been fixed, the other possibility is that the bug only happens after data is cached and updated via WP. But I haven't seen a bug like that since near the beginning of working on this plugin so it feels unlikely that that's it (not impossible though). |
Thank you for opening this issue. We recently moved this plugin over to the gatsbyjs monorepo and are trying to clean out this issue queue. This seems to be working after recent updates to the plugin. If you are still experiencing this issue, please provide a reproduction and open in the gatsbyjs repo. |
Hi,
I noticed that queries on products are quite hit-and-miss. Sometimes they work, other times no result is returned.
Not working despite the product clearly existing:
Working as expected if I select a different ID:
Working fine in playground:
Thanks!
The text was updated successfully, but these errors were encountered: