Setup Shopify
To use the Nuxt Shopify module, you may need to obtain certain credentials to connect with the Shopify APIs. Depending on which API you want to talk to, you might need different tokens and setup steps.
Prerequisites
Make sure you have a Shopify store.
If you don't have one, you can create a free trial store at shopify.com.
If you only want to use the Storefront API and don't need real data, you can use the mock
option
to get started right away without a Shopify store. See the module configuration for details.
Store Name
In order to talk to your Shopify store, you need to set the store's name in the module configuration.
export default defineNuxtConfig({
shopify: {
name: 'my-awesome-store',
},
})
The store name is the subdomain part of your Shopify preview URL. For example, if your preview store URL is my-awesome-store.myshopify.com
, then your store name is my-awesome-store
.
You can also find the name of your Shopify store by logging into your Admin Dashboard.
The name will be shown in the URL: admin.shopify.com/store/my-awesome-store
.
Storefront API
In order to use the Storefront API, you need to obtain a public or private access token. To obtain these tokens, sign in to your Shopify Admin Dashboard and follow these steps:
Install the Shopify Headless App
Go to the Shopify Headless app in the App Store and install it to your store.
Navigate to Headless Settings
In your Admin Dashboard, go to Sales Channels → Headless.
Select Your Store
Click on your store in the List of Storefronts.
Manage API Access
Under "Manage API Access", click Manage next to "Storefront API".
Get Your Tokens
You should now see the public and private access tokens for the Storefront API. You can also set scopes and permissions for the Storefront API from this interface.
Admin API
When you need to interact with the Admin API, you have to create a custom app to obtain an access token. To create a custom app, you can follow the steps in the Shopify documentation.