Shopify Product Importer with Multi-Variant Support
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:
- Shopify Store with Admin API access
-
Shopify API Credentials:
- Admin API Access Token
- Store URL (e.g.,
your-store.myshopify.com) - API Version:
2025-04or later
- Google Sheets with your product data
- 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-VARIANTfor variants, or justSKUfor 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
- In n8n, create a new Header Auth credential
- Set these values:
-
Name:
X-Shopify-Access-Token - Value: Your Shopify Admin API Access Token
-
Name:
Step 2: Update Workflow Nodes
-
Shopify, GetLocations node:
- Update the endpoint with your store URL
- Select your Shopify credentials
-
Get row(s) in sheet node:
- Connect your Google Sheets account
- Select your spreadsheet
- Choose the sheet with product data
- Update all other Shopify nodes with:
- Your store URL (replace
8jqk88-qg.myshopify.com) - Your Shopify credentials
- Your store URL (replace
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:
- Create a test sheet with 1 single product and 1 variant product (2-3 sizes)
- Run the workflow
- Check Shopify admin to verify products were created correctly
- 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
productOptionsnotvariantsin 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
- Use consistent naming: Keep product names identical for all variants
- Test incrementally: Start with 1-2 products before bulk import
- Check Shopify limits: Be aware of API rate limits for large imports
- Backup data: Export existing Shopify products before running
- Monitor execution: Watch the workflow run to catch errors early
n8n workflow file