commerce icon indicating copy to clipboard operation
commerce copied to clipboard

Where does the shopify/shema.d.ts come from?

Open FBosler opened this issue 3 years ago • 4 comments

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 avatar Apr 19 '21 18:04 FBosler

@FBosler schemas are created using graphql-codegen. created #285 to add the command used to generate that.

cond0r avatar Apr 20 '21 07:04 cond0r

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 avatar Aug 15 '22 05:08 jenniferhail

@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: image

2. Use the token to retrieve customer information (including orders) like so: image

You can also play around with the explorer to see what's possible and what isn't. See here.

FBosler avatar Aug 15 '22 05:08 FBosler

@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.

jenniferhail avatar Aug 15 '22 06:08 jenniferhail

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

manovotny avatar Apr 18 '23 02:04 manovotny