moltin / gatsby-source-moltin

🚀 Gatsby source plugin for building Elastic Path Commerce Cloud powered eCommerce websites
https://www.gatsbyjs.org/packages/@moltin/gatsby-source-moltin
MIT License
21 stars 4 forks source link

Stock levels are incorrect #21

Closed shendriksza closed 5 years ago

shendriksza commented 5 years ago

The GraphQL query for meta-stock gives incorrect data. It always reports "level": 0 and "availability": "out-stock" regardless of the values on Moltin

notrab commented 5 years ago

@shendriksza right now the inventories API is a standalone API that doesn't sync data back to the product API. We're working to merge these APIs to work in harmony, apologies it's confusing!

See more how inventories work in this post: https://www.moltin.com/developer/concepts/how-inventory-works

If you request a product directly, you will also notice a stock field, please do not use this field to read any stock values, as it is not currently updated. In future, this value will reflect the true inventory service value.

shendriksza commented 5 years ago

I understand, thank you. Currently we do use the Request API to query the stock and update our (static site) product page when the user visits, but we were hoping to also check the stock at compile time so that the stock levels will be mostly up to date and the request will only be used to verify

ynnoj commented 5 years ago

The dynamic nature of product stock levels would be best suited by an explicit request in your Gatsby site. We could add inventory fields to the product schema if deemed important, but I don't see the value personally.