一键导入
product-data-modeling
Structure your product catalog using your platform's native data model for variants, attributes, metafields, and product relationships
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Structure your product catalog using your platform's native data model for variants, attributes, metafields, and product relationships
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Manage supplier invoices and vendor payments with automated receipt matching, payment scheduling, early discount optimization, and reconciliation workflows
Enable wholesale and B2B sales with company accounts, custom catalogs, quote workflows, purchase orders, and net payment terms
Predict future inventory needs using historical sales data, seasonal trends, and reorder points to prevent stockouts and overstock
Launch a multi-vendor marketplace with seller onboarding, commission rules, automated payouts via Stripe Connect, and vendor dashboards
Control which products appear first in collections using automated ranking rules, manual overrides, and performance-based sorting algorithms
Sync your catalog and inventory across your own site, Amazon, eBay, and wholesale channels to sell everywhere from one system
| name | product-data-modeling |
| description | Structure your product catalog using your platform's native data model for variants, attributes, metafields, and product relationships |
| category | catalog-inventory |
| risk | safe |
| source | curated |
| date_added | 2026-03-12 |
| tags | ["product","catalog","schema","variants","attributes","database","modeling"] |
| triggers | ["design product schema","model product variants","product database design","catalog data model"] |
| tools | ["claude-code","cursor","gemini-cli","copilot","codex-cli","kiro","opencode"] |
| platforms | ["shopify","woocommerce","bigcommerce","custom"] |
| difficulty | intermediate |
Every platform has its own product data model — Shopify uses products with variants and metafields, WooCommerce uses products with attributes and custom fields, and BigCommerce uses products with options and custom fields. Understanding your platform's model and fitting your catalog into it correctly prevents data quality problems and import failures. Only build a custom data model if you're building a headless storefront from scratch.
| Platform | Product | Variants | Custom Attributes | Relationships |
|---|---|---|---|---|
| Shopify | Product + up to 3 Options, up to 100 Variants | Per-variant: price, SKU, inventory, weight, image | Metafields (standard or custom namespaces) | Collections, cross-sell via apps |
| WooCommerce | Product (Simple, Variable, Grouped, External) | Per-variation: price, SKU, stock, attributes | Custom product attributes + WooCommerce custom fields | Upsells, cross-sells (built-in), grouped products |
| BigCommerce | Product with Options and Option Sets | Per-variant (modifier/option combination): price, SKU, stock | Custom fields per product | Related products, bundled products |
| Custom / Headless | Design from scratch with PostgreSQL/MongoDB | Full control over schema | EAV or JSONB for flexible attributes | Junction tables for relationships |
Core structure:
Modeling decisions:
Product vs. Variant: Put a product into a single product record if customers compare the options side-by-side on one page. Create separate product records for fundamentally different products that happen to share a name.
Option naming: Shopify limits you to 3 options per product. If you need more (e.g., Size + Color + Material + Length), consider combining two options (e.g., "Size/Width") or using metafields for the 4th dimension.
Metafields for custom attributes: Go to Settings → Custom data → Products to create metafield definitions. Use metafields for attributes that:
Product types and tags: Use product_type for the primary merchandise category (e.g., "Dress", "Running Shoe") and tags for cross-cutting attributes (e.g., color-navy, occasion-formal, material-cotton).
Example product structure for a shirt:
care_instructions, material_weight_gsm, sustainability_certBulk field updates via Matrixify:
Product types:
Attributes and variations:
Go to Products → Attributes to define global attributes (shared across all products):
On a Variable product, go to Attributes tab:
Per-variation settings: set a unique price, SKU, stock, image, and weight for each variation
Custom fields (product metadata):
For attributes that aren't variants (e.g., technical specs, certifications):
Product relationships (built-in):
Core structure:
Modeling decisions:
Go to Products → Option Sets to create reusable option sets (e.g., "Clothing Sizes" with XS–3XL) — assign the same set to multiple products instead of recreating options per product.
For products with large variant counts: BigCommerce supports up to 600 SKUs per product. Use Bulk Pricing to set price rules that apply to variant groups rather than pricing each variant individually.
Custom fields: Go to Products → [Product] → Custom Fields tab to add structured attributes like Material, Care Instructions, Warranty Period. These display in the product detail page and can be used for search.
Modifier options (customer-configurable at purchase): Use for personalization (engraving text, color choice that doesn't affect stock). Different from variants — modifiers don't generate separate SKUs.
For headless storefronts, design the core schema around the product-options-variants pattern:
-- Core product tables (PostgreSQL)
CREATE TABLE products (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
slug VARCHAR(255) UNIQUE NOT NULL, -- URL-safe handle
title VARCHAR(500) NOT NULL,
description TEXT,
vendor VARCHAR(255),
product_type VARCHAR(255),
status VARCHAR(20) DEFAULT 'draft' CHECK (status IN ('active', 'draft', 'archived')),
tags TEXT[] DEFAULT '{}',
created_at TIMESTAMPTZ DEFAULT now(),
updated_at TIMESTAMPTZ DEFAULT now()
);
-- Variants — one per purchasable combination
CREATE TABLE product_variants (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
product_id UUID NOT NULL REFERENCES products(id) ON DELETE CASCADE,
sku VARCHAR(255) UNIQUE,
title VARCHAR(500) NOT NULL, -- e.g., "Red / Large"
price NUMERIC(10,2) NOT NULL, -- Use NUMERIC, not FLOAT, to avoid rounding errors
compare_at_price NUMERIC(10,2),
cost_price NUMERIC(10,2),
weight NUMERIC(8,2),
inventory_quantity INTEGER DEFAULT 0,
track_inventory BOOLEAN DEFAULT true,
option1_value VARCHAR(255), -- Denormalized for query performance
option2_value VARCHAR(255),
option3_value VARCHAR(255),
position INTEGER DEFAULT 0
);
-- Options and values — define the variation axes
CREATE TABLE product_options (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
product_id UUID NOT NULL REFERENCES products(id) ON DELETE CASCADE,
name VARCHAR(255) NOT NULL, -- "Color", "Size"
position INTEGER DEFAULT 0,
UNIQUE(product_id, name)
);
-- Flexible attributes via JSONB (alternative to EAV for custom attributes)
ALTER TABLE products ADD COLUMN attributes JSONB DEFAULT '{}';
-- Query example: SELECT * FROM products WHERE attributes->>'material' = 'cotton';
-- Index for common attribute lookups:
CREATE INDEX idx_products_attributes ON products USING GIN(attributes);
-- Product relationships
CREATE TABLE product_relationships (
source_product UUID NOT NULL REFERENCES products(id) ON DELETE CASCADE,
target_product UUID NOT NULL REFERENCES products(id) ON DELETE CASCADE,
relationship VARCHAR(50) NOT NULL CHECK (relationship IN ('cross_sell', 'upsell', 'related', 'accessory')),
position INTEGER DEFAULT 0,
UNIQUE(source_product, target_product, relationship)
);
TypeScript types matching this schema:
interface Product {
id: string;
slug: string; // URL handle — stable identifier
title: string;
description: string;
vendor: string;
productType: string;
status: 'active' | 'draft' | 'archived';
tags: string[];
attributes: Record<string, string | number | boolean>; // Flexible custom attributes
variants: ProductVariant[];
images: ProductImage[];
}
interface ProductVariant {
id: string;
sku: string;
title: string; // Auto-generated: "Red / Large"
price: number; // In cents to avoid floating-point errors
compareAtPrice?: number;
costPrice?: number;
inventoryQuantity: number;
trackInventory: boolean;
option1Value?: string;
option2Value?: string;
option3Value?: string;
}
Every platform supports product relationships for cross-selling and upselling. Configure them to increase AOV:
Upsells: Higher-value alternatives to the product the customer is viewing — shown on the PDP
Cross-sells: Complementary products — shown in the cart
Related products: Similar products at similar price points — shown at the bottom of the PDP
For Shopify: configure under Products → [Product] → More details section; or use a cross-sell app for automated suggestions.
For WooCommerce: configure under the Linked Products tab on each product.
$29.99 stored as 2999 eliminates floating-point rounding errors| Problem | Solution |
|---|---|
| Variant explosion (5 colors × 8 sizes × 3 materials = 120 variants) | Shopify caps at 100 variants per product; consider using metafields for the third option axis if most combinations aren't stocked separately |
| Custom attributes not appearing in product search | In Shopify: make metafields searchable in your theme or search app settings; in WooCommerce: enable "Used for variations" on attributes you want indexed |
| Product type and tags inconsistent across the catalog | Establish a controlled vocabulary for product types and tags before importing; use Matrixify or WP All Import to standardize in bulk |
| Variant images not switching when size/color is selected | Assign variant-specific images in the platform admin; variants need their own image, not just the product-level image, to trigger the swap |