Shopify product JSON plug-in data stale and other problems

I’m trying to combine my Dato Product content with my Shopify Product pricing into one product query in Gatsby. Wondering if anyone had any suggestions on how to get this working?

Options I’ve explored and their results:

  1. Using the Shopify product id plug-in. This works fine for programmatically created pages like single product pages. We currently query data from Dato (gatsby-node.js) and pass the Shopify id’s through the page context to the template, then query Shopify pricing in the template. Non-programmatically created pages like a product list page are a bit dicier due to the inability to run a second query after the first-page query and not being able to pass variables to the static query component.

  2. Using the Shopify product JSON plug-in. This would solve my problem but, the JSON data becomes stale if you don’t manually delete and re-add the Shopify connection every time you change data in Shopify. Also, I can’t find the repo this plug-in comes from, so I can’t even look at the code to potentially fix this issue.

  3. Digging into Gatsby’s Schema customization API I’m currently doing this but, it seems it may be easier to switch to Prismic to get this functionality out of the box instead of writing a custom solution.

Sorry if I sound frustrated, I’ve wasted 2 days messing with this and I’m running out of time.

hey @escmattresscenter,

have you looked into using this Gatsby feature: Extending third-party types? You could customise your fields (as we hint here) by querying the info from Shopify at build time.

In this way you would have the info refreshed from Shopify at every build and then you could use them wherever you need. What do you think?

I’m not familiar with the gatsby-shopify-source, but maybe you can have both that and the Dato source and pull content from both?

Surely with Prismic you can sync content from Shopify to them, but to me that is not a good solution as the frontend should be the place where you do that, as that better allows you to merge content, potentially change a part and not being as much locked in by a single service.

Hope this helps!