commerce
commerce copied to clipboard
Where does the shopify/shema.d.ts come from?
Love the repo! I'd like to potentially use the "Shopify GraphQL admin API" instead of the Storefront API though, for this I'd have to create a new schema potentially. Could you elaborate where the current one comes from/how it is generated?
@FBosler schemas are created using graphql-codegen. created #285 to add the command used to generate that.
Hi @FBosler. Did you ever switch to the Admin API? I'm currently trying to figure out how to build an orders page that shows past and current orders for a logged in customer, and I'm thinking I might be limited by the Storefront API.
@jenniferhail For some parts, you kinda have to. For orders, you don't have to necessarily though. It's pretty straightforward to make this accessible to logged-in only users. (as you can use a storefront query to retrieve customer access token).
1. First get the customer access token like so:
2. Use the token to retrieve customer information (including orders) like so:
You can also play around with the explorer to see what's possible and what isn't. See here.
@FBosler Your reply was just what I needed to get unstuck. Thank you!!
For some reason, the Shopify GraphiQL App doesn't match up with the explorer link you sent, so I was querying for a few fields that didn't actually exist.
Hey there! Thank you for your contribution. We have decided to take Next.js Commerce in a new direction and will be closing out current PRs and issues due to this change. Please see this PR for more details: #966