# Shopify Integration

> Part of the [NextBlog documentation](https://nextblog.ai/docs.md). Live page: [https://nextblog.ai/docs/integration-shopify](https://nextblog.ai/docs/integration-shopify)

Automatically publish blog posts to your Shopify store. This integration adds blog articles to your Shopify blog, perfect for content marketing and SEO.

#### Prerequisites

Before you begin, make sure you have:

- A Shopify store with admin access
- Permission to create custom apps in your Shopify store
- Admin API access enabled

### Step 1: Create Custom App in Shopify

#### 1.1 Navigate to Apps Section

1. Log into your Shopify admin dashboard
2. In the left sidebar, click on **"Apps"**
3. Scroll down and click **"Develop apps"** (or "App and sales channel settings" → "Develop apps")

![Navigate to Apps section in Shopify](https://nextblog.ai/shopify-steps/step1-shopify.png)

#### 1.2 Create New App

1. Click the **"Create an app"** button
2. Enter an app name: `NextBlog Integration`
3. Enter your email address (optional but recommended)
4. Click **"Create app"**

#### 1.3 Configure API Scopes

1. Set the app URL to `https://nextblog.ai`
2. Click on **"Configure Admin API scopes"**
3. Enable the following scopes:
  - `write_content` - To create blog articles
  - `read_content` - To read blog information
  - `write_files` - To upload images (optional)
  - `read_files` - To read file information (optional)
4. Click **"Save"**

![Configure API scopes for your Shopify app](https://nextblog.ai/shopify-steps/step2-create-app.png)

#### 1.4 Install the App

1. Click the **"Install app"** button at the top of the page
2. Review the permissions and click **"Install"** to confirm
3. Wait for the installation to complete

![Install app - step 1](https://nextblog.ai/shopify-steps/step3a-install.png)

![Install app - step 2](https://nextblog.ai/shopify-steps/step3b-install.png)

#### 1.5 Get Your API Credentials

1. Click on **"API credentials"** tab
2. Copy your **"Client ID"**
3. Copy your **"Client secret"**
4. **Important:** Save both credentials securely. You'll need them to connect NextBlog to Shopify.

![Get Client ID and Secret](https://nextblog.ai/shopify-steps/step4a-connect.png)

### Step 2: Configure Shopify Integration in NextBlog

#### 2.1 Navigate to Project Settings

1. Log into your NextBlog dashboard
2. Click on your project to open it
3. Click on **"Settings"**

#### 2.2 Enable Shopify Integration

1. Scroll down to the **"Shopify Integration"** section
2. Toggle the **"Enable Shopify Integration"** switch to ON

#### 2.3 Enter Shopify Credentials

Fill in the following fields:

- **Shopify Store URL:** Enter your store URL (e.g., `mystore.myshopify.com` - without https://)
- **Client ID:** Paste the Client ID from Step 1.4
- **Client Secret:** Paste the Client Secret from Step 1.4
- **Blog ID (Optional):** Leave empty to use your store's default blog, or enter a specific blog ID if you have multiple blogs

![Enter Shopify credentials in NextBlog](https://nextblog.ai/shopify-steps/step4b-connect.png)

#### 2.4 Test Connection

1. Click the **"Test Connection"** button
2. Wait for the test to complete
3. If successful, you'll see a green success message
4. If it fails, check your credentials and try again

#### 2.5 Save Changes

Click the **"Save Changes"** button to save your Shopify integration settings.

### How It Works

Once configured, here's what happens when you approve a blog post:

1. **Post Approval:** When you approve a blog post in NextBlog, the Shopify integration is triggered
2. **Content Conversion:** The markdown content is converted to HTML format
3. **Blog Selection:** The post is added to your default Shopify blog (or the specified blog ID)
4. **Article Creation:** A new Shopify article is created with:
  - Title from your NextBlog post
  - HTML content (converted from markdown)
  - Summary/excerpt
  - SEO-friendly handle (slug)
  - Featured image (if provided)
  - Author set to "NextBlog AI"
  - Tags: "SEO, AI Generated, NextBlog"
5. **Publishing:** The article is published to your Shopify blog and is immediately live

### Troubleshooting

#### Connection Test Fails

**Common issues:**

- **Incorrect store URL:** Make sure you're using the format `yourstore.myshopify.com` (without https://)
- **Invalid credentials:** Make sure you copied both Client ID and Client Secret correctly
- **Missing API scopes:** Verify that you enabled the required scopes in Step 1.3
- **App not installed:** Make sure you installed the app after creating it

#### Posts Not Publishing

**Check the following:**

- Make sure the integration is enabled in project settings
- Verify the connection test passes
- Check that you're approving posts (not just generating them)
- Look for error messages in your NextBlog dashboard
- Check Shopify admin for any failed article attempts

### Next Steps

Now that your Shopify integration is set up:

- Generate or create a blog post in NextBlog
- Review and approve the post
- Check your Shopify blog - the article should appear automatically!
- Customize the blog appearance in your Shopify theme settings
