$10+
Add to cart

Shopify Product Importer with Multi-Variant Support

$10+

Shopify Product Importer with Variants Support

Automatically import products from Google Sheets to Shopify, with full support for both single products and multi-variant products (like different sizes).

🎯 What This Workflow Does

This workflow reads product data from a Google Sheet and creates products in your Shopify store via GraphQL API. It intelligently handles:

  • Single products (e.g., a mug with one SKU)
  • Multi-variant products (e.g., t-shirts with 6 different sizes)
  • Automatic SKU parsing to group variants by product name
  • Inventory management across all variants
  • Media uploads for product images

πŸ“‹ Prerequisites

Before using this template, you'll need:

  1. Shopify Store with Admin API access
  2. Shopify API Credentials:
    • Admin API Access Token
    • Store URL (e.g., your-store.myshopify.com)
    • API Version: 2025-04 or later
  3. Google Sheets with your product data
  4. Google Sheets API credentials in n8n

πŸ“Š Google Sheet Format

Your Google Sheet should have these columns:

Product Name SKU Size Price On hand Inventory Product Image Branded Tee 11111111-SM SM 25.00 10 https://... Branded Tee 11111111-MD MD 25.00 15 https://... Branded Tee 11111111-LG LG 25.00 12 https://... Coffee Mug 22222222 15.00 50 https://...

Column Descriptions:

  • Product Name: Name of the product (variants share the same name)
  • SKU: Unique identifier. Format: BASESKU-VARIANT for variants, or just SKU for single products
  • Size: Variant option (leave blank for single products)
  • Price: Product price
  • On hand Inventory: Stock quantity
  • Product Image: Direct URL to product image

πŸ”§ Setup Instructions

Step 1: Configure Shopify Credentials

  1. In n8n, create a new Header Auth credential
  2. Set these values:
    • Name: X-Shopify-Access-Token
    • Value: Your Shopify Admin API Access Token

Step 2: Update Workflow Nodes

  1. Shopify, GetLocations node:
    • Update the endpoint with your store URL
    • Select your Shopify credentials
  2. Get row(s) in sheet node:
    • Connect your Google Sheets account
    • Select your spreadsheet
    • Choose the sheet with product data
  3. Update all other Shopify nodes with:
    • Your store URL (replace 8jqk88-qg.myshopify.com)
    • Your Shopify credentials

Step 3: Customize Product Details (Optional)

In the workflow, you can customize these defaults:

For variant products (in Shopify, CreateProduct node):

"vendor": "Zap Goods mfg.",  // Change to your vendor name
"productType": "Branded Merch",  // Change to your product type

For single products (in CreateProduct2 node):

"vendor": "Zap Goods mfg.",  // Change to your vendor name
"productType": "Branded Merch",  // Change to your product type

πŸš€ How It Works

Workflow Flow

1. Manual Trigger
   ↓
2. Get Shopify Location (for inventory)
   ↓
3. Read Google Sheet Data
   ↓
4. Group & Process Products (Code Node)
   ↓
5. Switch: Single vs Variant Products
   ↓
6a. VARIANT PATH               6b. SINGLE PATH
    - Create Product              - Create Product
    - Extract Option IDs          - Set Variant Details
    - Split Variants              - Set Inventory
    - Create Each Variant
    - Update Variant Details
    - Set Inventory per Variant

Key Logic

1. Product Grouping

  • The workflow groups products by Product Name
  • If multiple rows share the same name, they're treated as variants
  • SKUs are parsed to extract base SKU and variant suffix

2. Variant Detection

// Products with same name OR with Size field = variants
hasVariants = variants.length > 1 || variants[0].Size !== ''

3. Option Creation

  • Creates a "Size" option with all variant values
  • Shopify automatically generates variant combinations
  • Then maps each variant to set SKU, price, and inventory

4. Data Mapping

  • Each created variant is matched to original data by Size
  • Ensures correct SKU and inventory for each variant

πŸ“ Important Notes

SKU Format Rules

βœ… Correct formats:

  • Variant products: 11111111-SM, 11111111-MD, 11111111-LG
  • Single products: 22222222 (no dash)

❌ Incorrect formats:

  • Inconsistent base SKUs for same product
  • Missing size suffixes when Size column has value

Limitations

  • Maximum 100 variants per product (Shopify API limit)
  • Image URLs must be publicly accessible
  • One location per workflow run (uses first location)
  • All variants must have the same product name

Error Handling

The workflow includes checks for:

  • Missing option values
  • Unmatched variants
  • Invalid GraphQL responses

πŸ” Testing

Test with small data first:

  1. Create a test sheet with 1 single product and 1 variant product (2-3 sizes)
  2. Run the workflow
  3. Check Shopify admin to verify products were created correctly
  4. Verify SKUs, prices, and inventory are accurate

πŸ› οΈ Customization Options

Add More Product Options

To add options beyond Size (e.g., Color):

In single and multivariant products node, modify optionsGraph:

optionsGraph: [
  {
    name: "Size",
    values: variants.map(v => ({ name: v.Size }))
  },
  {
    name: "Color",
    values: variants.map(v => ({ name: v.Color }))
  }
]

Change Inventory Location

Modify the Shopify, GetLocations query to select a specific location:

query {
  locations(first: 10) {  # Get multiple locations
    edges {
      node {
        id
        name
      }
    }
  }
}

Then update inventory nodes to use the desired location.

Add Product Descriptions

Add a Description column to your sheet and update the productCreate mutations:

"descriptionHtml": "{{ $json.description }}"

πŸ“š Resources

πŸ› Troubleshooting

"Field is not defined on ProductCreateInput"

  • Check that you're using productOptions not variants in productCreate
  • Ensure GraphQL syntax is correct

Variants not created

  • Verify the Size column has values
  • Check that product names are identical for all variants
  • Ensure optionsGraph is properly formatted

Inventory not updating

  • Confirm location ID is valid
  • Check that inventory items have tracked: true
  • Verify quantity values are numbers, not strings

Images not appearing

  • Ensure image URLs are publicly accessible (no authentication required)
  • Check that URLs are HTTPS
  • Verify image format is supported (JPG, PNG, GIF, WebP)

πŸ’‘ Tips

  1. Use consistent naming: Keep product names identical for all variants
  2. Test incrementally: Start with 1-2 products before bulk import
  3. Check Shopify limits: Be aware of API rate limits for large imports
  4. Backup data: Export existing Shopify products before running
  5. Monitor execution: Watch the workflow run to catch errors early

$
Add to cart

n8n workflow file

Size
29.9 KB
Powered by