shopify Appfunction
Returns a set of functions that can be used by the app's backend to be able to respond to all Shopify requests.
The shape of the returned object changes depending on the value of distribution
. If it is , then only
objects are returned, otherwise
objects are included.
Function to create a new Shopify API object.
Anchor to shopifyApp-parametersParameters
Configuration options for your Shopify app, such as the scopes your app needs.
Anchor to shopifyApp-returnsReturns
An object constructed using your appConfig. It has methods for interacting with Shopify.
Anchor to future flagsFuture flags
Set future flags using the future
configuration field to opt in to upcoming breaking changes.
With this feature, you can prepare for major releases ahead of time, as well as try out new features before they are released.
When enabled, methods for interacting with the admin REST API will not be returned.
This affects:
authenticate.admin(request)
*authenticate.webhook(request)
*authenticate.flow(request)
**
*
unauthenticated.admin(shop)
In a future release we will remove REST from the package completely.
Please see: https://www.shopify.com/ca/partners/blog/all-in-on-graphql
When enabled, embedded apps will fetch access tokens via token exchange. This assumes the app has scopes declared for Shopify managing installation.
Learn more about this new embedded app auth strategy.
The minimum viable configuration
/shopify.server.ts
Anchor to examplesExamples
Anchor to example-adddocumentresponseheadersaddDocumentResponseHeaders
Anchor to example-return-headers-on-all-requestsReturn headers on all requests
Add headers to all HTML requests by calling in
entry.server.tsx
.
Return headers on all requests
Anchor to example-authenticateauthenticate
Anchor to example-authenticate-shopify-requestsAuthenticate Shopify requests
Use the functions in authenticate
to validate requests coming from Shopify.
Authenticate Shopify requests
Anchor to example-registerwebhooksregisterWebhooks
Anchor to example-registering-shop-specific-webhooks-after-installRegistering shop-specific webhooks after install
Trigger the registration to create the shop-specific webhook subscriptions after a merchant installs your app using the hook. Learn more about subscribing to webhooks.
Registering shop-specific webhooks after install
app/shopify.server.ts
Anchor to example-sessionstoragesessionStorage
Anchor to example-storing-sessions-with-prismaStoring sessions with Prisma
Import the package to store sessions in your Prisma database.
Storing sessions with Prisma
/app/shopify.server.ts
Anchor to example-unauthenticatedunauthenticated
Anchor to example-using-unauthenticated-contextsUsing unauthenticated contexts
Create contexts for requests that don't come from Shopify.
Using unauthenticated contexts
Anchor to example-creating-a-login-pageCreating a login page
Use shopify.login
to create a login form, in a route that can handle GET and POST requests.