Updated products_text_import.txt with proper variant format Updated TEXT_IMPORT_GUIDE.md documentation
6.0 KiB
LittleShop Text Import Guide - Variant Collections
Summary of Changes
The text import format already supports variant collections natively! The CSV import was incorrectly using multi-buys instead of proper variant collections.
Text Import Format (with Variant Collections)
Basic Structure
# Product Name; Variant Collection Name
<text>
Optional description here
</text>
category: CategoryName
price: BasePrice (optional when using variants)
weight: BaseWeight (optional when using variants)
unit: Unit
stock: StockQuantity
- Variant1Name; Price; StockLevel
- Variant2Name; Price; StockLevel
- Variant3Name; Price; StockLevel
Example: Weight-Based Product (Grams)
# Four whittteee; Weights - Standard
category: Flour
unit: Grams
stock: 100
- 28g; 700; 100
- 14g; 360; 100
- 7g; 190; 100
- 3.5g; 100; 100
Example: Unit-Based Product (Tablets)
# tablets - Vitamin-C; Single Units
<text>Dutch import</text>
category: Vitamins
unit: Unit
stock: 100
- 100; 150; 100
- 50; 80; 100
- 25; 50; 100
- 10; 30; 100
Key Differences: Variants vs Multi-Buys
Variants (Lines starting with -)
Format: - VariantName; Price; StockLevel
Use Case: Different sizes, weights, or quantities of the SAME product
Example: - 28g; 700; 100 (28g size for £7.00 with 100 in stock)
Links to: Variant Collections ("Weights - Standard", "Single Units", etc.)
Multi-Buys (Lines starting with +) ❌ DON'T USE FOR THIS DATA
Format: + Name; Quantity; Price
Use Case: Bulk purchase discounts (2 for £19, 3 for £25)
Example: + Twin Pack; 2; 19.00 (Buy 2 items for £19)
Not applicable: For single product variants
Variant Collections
You must create variant collections in the admin panel first:
- Weights - Standard: For gram-based products (28g, 14g, 7g, etc.)
- Single Units: For individual countable items (tablets, capsules)
These collections define the presentation format and UI behavior for variants.
Complete Import File
See: products_text_import.txt - Ready to use with 13 products properly formatted
Products Included:
- Flour Category (3 products): Four whittteee, double washed Flour, Chocolate infused
- Cereal Category (3 products): Cereal, Himalayan Cereal Blush, Cereal Rock
- Vitamins Category (5 products): Various vitamin tablets and organic options
- Herbal Category (2 products): Guarana products
How to Import
Option 1: Via Admin UI
- Go to Admin → Products → Import (Text Format)
- Upload
products_text_import.txtOR paste content into textarea - Check "Replace All" if you want to delete all existing products first
- Click Import Products
Option 2: Via API (if needed)
POST /Admin/Products/ImportText
Content-Type: multipart/form-data
textContent: [paste file content]
replaceAll: true
Important Notes
✅ DO THIS
- Use
-prefix for product variants (different sizes/quantities) - Link products to variant collections for consistent UX
- Use
Unitfor countable items (tablets, capsules) - Use
Gramsfor weight-based products - Use "Replace All" checkbox to clear existing data before import
❌ DON'T DO THIS
- Don't use
+multi-buys for size variants - Don't use multi-buys at all (they're for bundle discounts)
- Don't forget to create variant collections first
- Don't import without checking "Replace All" if you want clean data
Variant Collection Setup
Before importing, create these variant collections in admin panel:
1. Weights - Standard
- Name:
Weights - Standard - Description: Standard weight-based product variants
- Used for: Flour, Cereal, Herbal gram-based products
2. Single Units
- Name:
Single Units - Description: Individual countable items
- Used for: Tablets, capsules, individual items
Field Reference
| Field | Required | Description | Example |
|---|---|---|---|
# ProductName; VariantCollection |
Yes | Product name and variant collection | # Vitamin-C; Single Units |
<text>Description</text> |
No | Product description | <text>Dutch import</text> |
category: CategoryName |
Yes | Product category | category: Vitamins |
unit: WeightUnit |
Yes | Unit type (Unit/Grams/etc.) | unit: Grams |
stock: Number |
No | Base stock quantity | stock: 100 |
- Name; Price; Stock |
No | Variant definition | - 28g; 700; 100 |
Weight Unit Options
Unit- For individual items (tablets, pills, pieces)Grams- Standard metric weightKilograms- Larger metric weightPounds- Imperial weightOunces- Imperial weight
Features Added
- ✅ Replace All Option: Checkbox in text import UI (same as CSV)
- ✅ Controller Support:
replaceAllparameter added to ImportText action - ✅ Documentation: Updated UI hints to show variant collection format
- ✅ Unit Support: Added
Unitto the weight unit documentation
Files Modified
- ProductsController.cs: Added
replaceAllparameter to ImportText action - ImportText.cshtml: Added "Replace All" checkbox and updated documentation
- products_text_import.txt: Created properly formatted import file
Testing
-
Create Variant Collections in Admin Panel:
- "Weights - Standard"
- "Single Units"
-
Import Data:
- Go to Admin → Products → Import (Text Format)
- Upload
products_text_import.txt - Check "Replace All" if needed
- Click Import
-
Verify Results:
- Check Products page shows 13 products
- Check each product has variants linked to correct collection
- Verify variant pricing displays correctly
Migration from CSV
The old CSV format used multi-buys incorrectly:
Variations,PhotoUrls
"28g:1:700;14g:1:360" ← WRONG (multi-buy format)
The text format uses variants correctly:
# Product; Weights - Standard
- 28g; 700; 100 ← CORRECT (variant format: name; price; stock)
- 14g; 360; 100
Generated: 2025-10-08 Format: Human-Readable Text Import with Variant Collections Ready to Use: Yes