How to Detect Product Variants on E-commerce Websites

Product variant detection is the process of identifying different versions of the same product—such as size, color, storage, capacity, material, or configuration—and correctly associating each variant with its own identifiers, availability, and other attributes.

This sounds straightforward until you begin collecting product data at scale.

A single e-commerce product page may represent dozens or even hundreds of possible combinations. Some variants have their own SKU or GTIN. Others share a parent product identifier. Certain combinations may be unavailable, while others may not exist at all. On modern JavaScript-based websites, selecting a variant can also change the product URL, price, images, availability, or data returned by background requests.

If these relationships are extracted incorrectly, downstream datasets can become unreliable. Prices may be assigned to the wrong size, inventory may be attributed to the wrong color, and product matching systems may compare different configurations as if they were identical.

This guide explains how to detect product variants reliably and model them as structured data for e-commerce analysis.

What Is Product Variant Detection?

A product variant is a specific configuration of a broader product.

Consider a smartphone sold with three storage capacities and four colors:

128GB × Black
128GB × White
128GB × Blue
128GB × Green

256GB × Black
256GB × White
...

512GB × Green

The product family may be the same, but each valid combination can represent a different sellable item.

A useful model is:

Product Family
      ↓
Variant Dimensions
      ↓
Specific Variant
      ↓
Retailer Offer

For example:

Example Phone X
      ↓
Storage + Color
      ↓
256GB / Black
      ↓
SKU: PX-256-BLK
GTIN: 0123456789012
      ↓
Price / Availability / Seller

Product variant detection therefore involves more than extracting options from a dropdown. The objective is to reconstruct the relationship between the parent product, its variant dimensions, valid combinations, identifiers, and commercial information.

Product Family vs Product Variant vs Offer

Before building a variant extraction system, separate three concepts that are frequently mixed together.

A product family represents the broader product model.

A product variant represents a particular configuration of that product.

An offer represents the commercial conditions under which a retailer or seller is currently selling that variant.

For example:

Running Shoe Model X
        ↓
Black / EU 42
        ↓
Retailer A
$129
In Stock

Price and availability belong primarily to the offer observation. Size and color belong to the variant. The model name belongs to the broader product identity.

Keeping these layers separate makes later price comparison and inventory analysis considerably easier.

Why Product Variant Detection Is Difficult

The visible page does not necessarily represent the complete product structure.

Some websites render every available option into the HTML. Others expose only the currently selected variant. JavaScript may retrieve new information after a user changes a color or size.

There are also dependencies between options.

Suppose a shoe is available in:

Black:
38, 39, 40, 41, 42

White:
39, 40, 41

A scraper that independently extracts:

Colors = [Black, White]
Sizes = [38, 39, 40, 41, 42]

might incorrectly generate:

White / 38
White / 42

even though those combinations do not exist.

The challenge is therefore not simply discovering option values. It is discovering valid relationships between option values.

Start by Identifying Variant Dimensions

Variant dimensions describe the properties that distinguish one variant from another.

Common dimensions include:

Color
Size
Storage
Memory
Capacity
Material
Style
Length
Width
Voltage
Region
Pack quantity

The dimensions depend heavily on the product category.

For apparel:

Color + Size

For smartphones:

Color + Storage

For laptops:

Processor + RAM + Storage + Display

For furniture:

Material + Color + Size

For industrial products:

Voltage + Capacity + Connector + Revision

Avoid assuming that every option shown on a page represents a variant dimension. Options such as delivery method, warranty extension, gift wrapping, or financing may modify the purchase experience without creating a different underlying product variant.

Where Variant Information Can Be Found

A robust extraction system should inspect several possible sources.

Variant Selectors in the DOM

The most obvious source is the product interface.

A page might contain:

<select name="size">
    <option value="S">Small</option>
    <option value="M">Medium</option>
    <option value="L">Large</option>
</select>

Colors may instead appear as buttons:

<button
    data-color="black"
    data-sku="TSHIRT-BLK">
    Black
</button>

These elements can reveal available option values and sometimes identifiers.

However, the DOM may represent only the current state rather than the complete variant matrix.

Embedded Product Data

Many modern e-commerce websites include serialized product data somewhere in the page.

A simplified object might look like:

{
  "product_id": "TSHIRT-001",
  "variants": [
    {
      "sku": "TSHIRT-BLK-S",
      "color": "Black",
      "size": "S",
      "available": true
    },
    {
      "sku": "TSHIRT-BLK-M",
      "color": "Black",
      "size": "M",
      "available": false
    },
    {
      "sku": "TSHIRT-WHT-M",
      "color": "White",
      "size": "M",
      "available": true
    }
  ]
}

When available and appropriate to process, this representation can be much more useful than independently reading buttons from the interface because the relationship between attributes and variants is already explicit.

The exact location and structure vary by website, so extraction logic should be source-aware.

JSON-LD Product Data

Some websites expose product information using structured data.

For example:

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Example Running Shoe",
  "sku": "SHOE-BLK-42",
  "color": "Black",
  "size": "42",
  "offers": {
    "@type": "Offer",
    "price": "129.00",
    "priceCurrency": "USD",
    "availability": "https://schema.org/InStock"
  }
}

JSON-LD is useful because fields have clearer semantic meaning than arbitrary CSS classes.

But it should not automatically be assumed to contain every variant.

Some pages expose structured data only for the currently selected variant. Others describe the parent product rather than individual configurations.

Treat JSON-LD as one evidence source rather than the complete variant model unless the source has been verified.

Browser Network Responses

On JavaScript-heavy websites, changing an option may trigger an XHR or fetch request.

The interaction might look like:

Select Black
     ↓
Select Size 42
     ↓
Browser Request
     ↓
Variant API
     ↓
SKU / Price / Availability / Images

For browser automation workflows, Playwright can observe responses produced during normal page interactions:

page.on('response', async (response) => {
  const contentType =
    response.headers()['content-type'] || '';

  if (!contentType.includes('application/json')) {
    return;
  }

  try {
    const data = await response.json();

    // Inspect relevant product or variant responses.
  } catch {
    // Ignore responses that are not valid JSON.
  }
});

Production implementations should filter for known relevant endpoints or expected response schemas rather than storing every JSON response.

Network observations can be particularly valuable when variant state is not fully represented in the initial HTML.

Do Not Generate a Cartesian Product Blindly

Suppose a page contains:

Colors:
Black
White
Blue

Sizes:
S
M
L
XL

A naive system may calculate:

3 × 4 = 12 variants

But perhaps the actual catalog contains only:

Black: S, M, L, XL
White: S, M, L
Blue: M, L

There are nine valid variants, not twelve.

This distinction is critical.

Instead of generating every possible combination, build the variant matrix from evidence supplied by the website.

A structured representation could be:

{
  "Black": ["S", "M", "L", "XL"],
  "White": ["S", "M", "L"],
  "Blue": ["M", "L"]
}

Or preferably store each actual variant independently.

Model Every Variant as Its Own Record

For downstream analytics, a flat variant record is often easier to work with than a deeply nested product object.

For example:

{
  "parent_product_id": "TSHIRT-001",
  "variant_id": "TSHIRT-BLK-M",
  "attributes": {
    "color": "Black",
    "size": "M"
  },
  "sku": "TSHIRT-BLK-M",
  "gtin": "0123456789012",
  "availability": "out_of_stock",
  "price": 29.99,
  "currency": "USD"
}

Another variant becomes another record.

This structure makes it easier to answer questions such as:

  • Which sizes are available?
  • Which color has the highest price?
  • Which variants disappeared from the catalog?
  • Which exact configuration matches another retailer?
  • Which SKU changed availability?

The parent-child relationship remains available through parent_product_id.

Associate SKU and GTIN With the Correct Variant

This is one of the most important parts of the entire process.

A product page may contain:

Parent SKU
Current Variant SKU
Alternative Variant SKUs
Recommended Product SKUs
Related Product IDs

Simply searching the HTML for sku can return several valid values.

Each identifier should therefore be stored together with evidence about its scope.

For example:

{
  "identifier_type": "sku",
  "value": "TSHIRT-BLK-M",
  "scope": "variant",
  "variant": {
    "color": "Black",
    "size": "M"
  },
  "source": "variant_data"
}

This prevents a valid identifier from being attached to the wrong configuration.

The same principle applies to GTIN, UPC, EAN, MPN, and retailer-specific product IDs.

Distinguish Unavailable Variants From Nonexistent Variants

These states are not equivalent.

Consider:

Black / XL → Out of stock
White / XL → Does not exist

Both may be impossible to purchase today, but they carry very different information.

An out-of-stock variant exists in the retailer’s catalog and may become available again.

A nonexistent combination may never have been offered.

A useful status model could include:

in_stock
out_of_stock
unavailable
not_offered
unknown

Avoid converting all disabled options into out_of_stock.

The website may disable an option because it is incompatible with another selection rather than because inventory is zero.

Dynamic Variant Selection Requires State Management

Some websites do not expose every variant until the user interacts with the page.

Selecting one attribute may change the available values of another.

For example:

Step 1: Select Color = Black
Step 2: Available sizes become 38, 39, 40, 42
Step 3: Select Size = 42
Step 4: Page updates SKU and price

Browser automation can reproduce these interactions where appropriate, but the collector needs to understand page state.

After each selection, verify that the expected change has occurred before recording the result.

Avoid relying solely on arbitrary waits such as:

await page.waitForTimeout(3000);

A more reliable strategy is to wait for a meaningful state change, such as a relevant response, changed SKU, updated product element, or confirmed selection state.

Variant URLs Can Be Valuable Identifiers

Some retailers create a distinct URL for each variant.

For example:

/product/shirt?color=black&size=m

Others use:

/product/shirt/variant/847291

And some update only the browser state without changing the URL.

When a stable variant-specific URL exists, preserve it.

A useful record might include:

{
  "parent_url": "https://example.com/product/shirt",
  "variant_url":
    "https://example.com/product/shirt?color=black&size=m"
}

This improves traceability and makes it easier to revisit the exact configuration later.

Do not assume query parameters always define variants, though. Some parameters represent tracking, sorting, referral information, or session state.

Normalize Variant Attributes Carefully

Retailers may represent equivalent attributes differently.

Sizes might appear as:

Large
L
LG

Storage:

1 TB
1TB
1000GB

Colors:

Midnight
Midnight Black
Black

Normalization can make cross-retailer analysis easier, but it should not destroy meaningful distinctions.

For example:

Black
Space Black
Midnight

should not automatically be normalized into one color merely because they appear visually similar.

A safer structure preserves both:

{
  "raw_color": "Midnight",
  "normalized_color_family": "Black",
  "manufacturer_color": "Midnight"
}

This allows broad color analysis without losing the manufacturer’s actual variant definition.

Pack Size Is Also a Variant Attribute

Quantity is frequently overlooked.

Consider:

Protein Bar 60g
Protein Bar 60g × 6
Protein Bar 60g × 12

These are not equivalent commercial products.

A structured record should distinguish:

{
  "unit_size": 60,
  "unit": "g",
  "pack_quantity": 12,
  "total_quantity": 720
}

Without pack normalization, price comparison systems can incorrectly conclude that a 12-pack is dramatically more expensive than a single unit.

This is one reason variant detection and price comparison should be connected but remain separate stages.

Detect Parent Products and Child Variants

Many e-commerce platforms internally use a parent-child catalog model.

The parent might contain:

Title
Description
Brand
Product family
Shared images

while children contain:

SKU
GTIN
Color
Size
Price
Availability

Your dataset can mirror this relationship.

For example:

{
  "parent": {
    "id": "SHIRT-100",
    "name": "Performance T-Shirt",
    "brand": "Example"
  },
  "variants": [
    {
      "id": "SHIRT-100-BLK-M",
      "color": "Black",
      "size": "M"
    }
  ]
}

This reduces duplication while preserving variant-specific information.

How Product Variant Detection Improves Product Matching

Variant detection becomes particularly important when data is collected from multiple retailers.

Suppose Retailer A lists:

Camera X — Black — Body Only

while Retailer B lists:

Camera X Black + 18-55mm Lens

At the family level, both may belong to Camera X.

At the sellable-product level, they are different.

A robust workflow therefore looks like:

Product Collection
        ↓
Identifier Extraction
        ↓
Product Family Detection
        ↓
Product Variant Detection
        ↓
Variant Normalization
        ↓
Cross-Retailer Product Matching

This reduces the risk of comparing prices or availability across incompatible configurations.

Track Variant Changes Over Time

Product variant data is not static.

Retailers may:

  • Add new colors.
  • Remove discontinued sizes.
  • Introduce new storage configurations.
  • Restock existing variants.
  • Replace an old SKU.
  • Change the GTIN associated with a listing.
  • Convert a bundle into a standalone listing.

Instead of overwriting the previous record, consider storing observations over time.

For example:

{
  "variant_id": "SHIRT-BLK-M",
  "observed_at": "2026-09-24T10:00:00Z",
  "availability": "in_stock",
  "price": 29.99
}

Historical observations make it possible to distinguish a genuine catalog change from a temporary collection failure.

Validate Product Variant Detection at Scale

A variant extractor should have measurable quality indicators.

Useful metrics include:

Average variants per product
Products with zero detected variants
Variants missing SKU
Variants missing key attributes
Duplicate variant combinations
Invalid attribute combinations
Variant extraction failure rate
Unexpected changes in variant count

Suppose a retailer normally has an average of eight variants per apparel product and the extracted average suddenly falls to 1.2.

That could indicate a real catalog change, but it could also mean the extractor is now seeing only the default selected variant.

Monitoring distribution changes can reveal problems that request-success metrics alone will miss.

Common Product Variant Detection Mistakes

One common mistake is assuming that every selectable option represents a separate variant. Warranty, shipping method, gift packaging, and subscription settings may not define product identity.

Another is creating all possible combinations from independently extracted option lists. This produces nonexistent variants when attributes depend on one another.

A third mistake is attaching the first SKU or GTIN found on the page to every variant.

Finally, avoid treating disabled as synonymous with out of stock. A disabled combination may be invalid, unavailable in a particular configuration, or temporarily inaccessible for another reason.

The extraction model should preserve these distinctions rather than forcing every state into a simple yes/no availability field.

Where ColaProxy Fits Into Variant Data Collection

Product variant detection belongs primarily to the data extraction layer, but reliable collection is still necessary before variants can be analyzed.

When permitted e-commerce collection spans multiple markets, retailers may expose different variants depending on region. Storage configurations, colors, pack sizes, product codes, and availability can differ between countries.

A typical architecture might therefore be:

Target Market
      ↓
Collection Infrastructure
      ↓
Product Page
      ↓
HTML / JSON-LD / Application Data
      ↓
Variant Detection
      ↓
SKU & GTIN Association
      ↓
Normalization
      ↓
Product Matching
      ↓
E-commerce Dataset

ColaProxy provides proxy infrastructure that developers can evaluate for permitted web data collection and browser automation workflows, including cases where geographic routing or session continuity is relevant.

Proxy infrastructure does not determine which variants exist. It supports the collection layer, while extraction and validation logic determine whether the resulting product data is accurate.

Conclusion

Product variant detection is much more than extracting colors and sizes from a product page.

A reliable system needs to identify variant dimensions, reconstruct valid combinations, distinguish unavailable variants from nonexistent ones, associate identifiers with the correct configuration, and preserve the relationship between parent products, variants, and retailer offers.

Modern e-commerce websites may expose this information through the DOM, JSON-LD, embedded application data, or browser network responses. The strongest extraction pipelines use the most semantically reliable sources available and validate the result rather than depending on a single selector.

When these relationships are modeled correctly, product variant data becomes much more useful for catalog intelligence, product matching, availability analysis, and cross-retailer comparison.

For large-scale e-commerce projects, accurate variant detection is one of the key steps that turns raw product pages into a reliable structured dataset.

Frequently Asked Questions

What is product variant detection?

Product variant detection identifies the different configurations of a product, such as color, size, storage, capacity, or material, and associates each configuration with the correct identifiers and product data.

How can I find product variants on an e-commerce page?

Check variant selectors, structured data, embedded product objects, HTML attributes, and relevant data returned during normal browser interactions. The best source depends on the website architecture.

Does every product variant have a different SKU?

Not necessarily. Many retailers assign separate SKUs to variants, but implementations vary. Some identifiers belong to the parent product while others belong to individual variants.

Should I generate every possible combination of product options?

No. If color and size options depend on each other, generating a Cartesian product can create combinations that do not actually exist. Build the variant matrix from source evidence instead.

Is an unavailable variant the same as an out-of-stock variant?

No. An out-of-stock variant generally represents an existing configuration with no current inventory. An unavailable option may represent an invalid or unsupported combination.

Why is product variant detection important for product matching?

Two listings may represent the same product family but different configurations. Variant detection helps prevent different sizes, storage capacities, bundles, or regional versions from being incorrectly matched.

About the Author

A

Alyssa

Senior Content Strategist & Proxy Industry Expert

Alyssa is a veteran specialist in proxy architecture and network security. With over a decade of experience in network identity management and encrypted communications, she excels at bridging the gap between low-level technical infrastructure and high-level business growth strategies. Alyssa focuses her research on global data harvesting, identity anonymization, and anti-fingerprinting technologies, dedicated to providing authoritative guides that help users stay ahead in a dynamic digital landscape.

The ColaProxy Team

The ColaProxy Content Team is comprised of elite network engineers, privacy advocates, and data architects. We don't just understand proxy technology; we live its real-world applications—from social media matrix management and cross-border e-commerce to large-scale enterprise data mining. Leveraging deep insights into residential IP infrastructures across 200+ countries, our team delivers battle-tested, reliable insights designed to help you build an unshakeable technical advantage in a competitive market.

Why Choose ColaProxy?

ColaProxy delivers enterprise-grade residential proxy solutions, renowned for unparalleled connection success rates and absolute stability.

  • Global Reach: Access a massive pool of 50 million+ clean residential IPs across 200+ countries.
  • Versatile Protocols: Full support for HTTP/SOCKS5 protocols, optimized for both dynamic rotating and long-term static sessions.
  • Elite Performance: 99.9% uptime with unlimited concurrency, engineered for high-intensity tasks like TikTok operations, e-commerce scaling, and automated web scraping.
  • Expert Support: Backed by a deep engineering background, our 24/7 expert support ensures your global deployments are seamless and secure.
Disclaimer

All content on the ColaProxy Blog is provided for informational purposes only and does not constitute legal advice. The use of proxy technology must strictly comply with local laws and the specific Terms of Service of target websites. We strongly recommend consulting with legal counsel and ensuring full compliance before engaging in any data collection activities.