> ## Documentation Index
> Fetch the complete documentation index at: https://docs.garmint.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Shopify Integration

> Connect your Shopify store and sell AI-generated designs as print-on-demand products

<Note>
  Shopify integration is currently in preview. [Request early access](/shopify/install) to join the beta.
</Note>

## Overview

The Shopify integration allows you to publish your AI-generated designs directly to your Shopify store as print-on-demand products. When customers purchase, orders automatically flow into Garmint's production system.

## How It Works

<Steps>
  <Step title="Connect Your Store">
    Navigate to the [Shopify page](/shopify) and enter your Shopify store domain. You'll be redirected to Shopify to authorize the connection.
  </Step>

  <Step title="Design & Publish">
    Create designs in the Studio, then use the "Publish to Shopify" button to push products to your store with custom pricing.
  </Step>

  <Step title="Orders Flow Automatically">
    When customers purchase on your Shopify store, orders are automatically created in Garmint's production queue via webhooks.
  </Step>

  <Step title="Fulfillment Sync">
    Once printed and shipped, tracking information syncs back to Shopify so customers see delivery updates.
  </Step>
</Steps>

## Features

### Store Connection

* **Secure OAuth** — Industry-standard OAuth 2.0 flow, no passwords stored
* **Multi-store support** — Connect multiple Shopify stores from one Garmint account
* **Connection status** — Real-time visibility into store connection health

### Product Publishing

* **One-click publish** — Push designs to Shopify with custom pricing
* **Automatic variants** — Size options created automatically
* **Price recommendations** — Suggested retail price based on production costs

### Order Management

* **Webhook sync** — Orders appear in Garmint within seconds
* **Customer data** — Full shipping address and contact info transferred
* **Order tracking** — Status visible in both Garmint and Shopify admin

### Fulfillment

* **Shipping labels** — ShipStation integration for label generation
* **Tracking sync** — Tracking numbers pushed back to Shopify
* **Delivery notifications** — Customers notified through Shopify

## Pricing

| Cost Component    | Amount        |
| ----------------- | ------------- |
| DTG Print (front) | \$30.00       |
| Blank Garment     | \~\$15.00     |
| Fulfillment       | \$5.00        |
| **Total Cost**    | **\~\$50.00** |

Set your retail price above $50 to ensure profit. We recommend **$59.99\*\* as a starting price.

## Technical Details

### Webhooks

The following Shopify webhooks are automatically registered when you connect:

* `orders/create` — New order notifications
* `orders/paid` — Payment confirmation
* `app/uninstalled` — Store disconnection

### API Endpoints

| Endpoint                            | Description                |
| ----------------------------------- | -------------------------- |
| `POST /api/shopify/connect/install` | Initiate OAuth flow        |
| `GET /api/shopify/callback`         | OAuth callback handler     |
| `GET /api/shopify/connect`          | List connected stores      |
| `DELETE /api/shopify/connect/[id]`  | Disconnect a store         |
| `POST /api/shopify/publish`         | Publish product to Shopify |
| `POST /api/shopify/webhooks/orders` | Order webhook handler      |

### Database Schema

```sql theme={}
-- Store connections
shopify_connections (
  id, user_id, shop_domain, shop_name, 
  access_token, status, installed_at
)

-- OAuth state management
shopify_oauth_states (
  state, user_id, shop_domain, 
  created_at, expires_at
)

-- Published products
shopify_published_products (
  id, user_id, shopify_product_id, 
  generation_id, base_price_cents
)

-- Inbound orders from Shopify
shopify_inbound_orders (
  id, shopify_order_id, shop_domain,
  customer_data, line_items, status
)
```

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection failed with 'Invalid OAuth state'">
    This occurs if you took too long to authorize or navigated away during the OAuth flow. Try connecting again from the Shopify page.
  </Accordion>

  <Accordion title="Products not appearing in Shopify">
    Check that your store connection status is "Active" on the Shopify page. If disconnected, reconnect your store.
  </Accordion>

  <Accordion title="Orders not syncing">
    Webhooks may need to be re-registered. Disconnect and reconnect your store to refresh webhook subscriptions.
  </Accordion>
</AccordionGroup>

## Coming Soon

* **Variant customization** — Choose which sizes to offer
* **Inventory sync** — Automatic stock updates
* **Multi-placement** — Front and back print options
* **Analytics** — Sales and conversion tracking
