Project

General

Profile

Support #10911 » Dynamic_Category_Filters_And_Variants_Gap_Analysis.md

Yalavarthi Thriveni, 09/18/2026 11:41 AM

 

R&D Gap Analysis: Dynamic Category-Specific Filters & Product Variant Architecture

Document Version: 1.0
Scope: E-Commerce Backend (evergreen_pos_be) & Storefront Application (evergreenpos_E-commerce_new)


Executive Summary

Current storefront search and filter mechanisms rely on flat, static schemas (feature: [String], hardcoded facet keys like plantType, color, brand). In modern e-commerce platforms, different product categories require distinct, dynamic filter dimensions and multi-option variant management:

  • Fashion & Apparel: Filter by Size (S, M, L, XL), Material (Cotton, Linen), Pattern (Solid, Striped), Fit (Slim Fit, Regular Fit).
  • Food & FMCG: Filter by Pack Size (200 ml, 500 gms, 1 kg), Dietary Preference (Vegetarian, Vegan, Organic), Shelf Life.
  • Plants & Gardening: Filter by Sunlight Requirement (Full Sun, Shade), Water Requirement (Low, Moderate), Pot Size (6-inch, 10-inch).

This document provides a comprehensive Gap Analysis comparing our current schema against industry-standard e-commerce architectures (Shopify, Magento, .Amazon) and defines the exact data parameters, schema models, API endpoints, and business justifications needed to support dynamic category-driven filters and SKU variants.


1. Current Architecture vs. Target Architecture

CURRENT ARCHITECTURE (Static & Flat)
Category Schema ──► Simple Name & Slug
Product Schema  ──► Static Fields (price, quantity, feature: [String])
Storefront PLP  ──► Hardcoded Facets (Type, PlantType, Brand, Color)

TARGET ARCHITECTURE (Dynamic & Attribute-Driven)
Category Schema ──► Defines Attribute Templates & Dynamic Filter Keys
Product Schema  ──► Dynamic Attribute Map { size: "XL", material: "Cotton" }
Variant Schema  ──► Multi-SKU Options (200ml @ $2, 500g @ $5, 1kg @ $9)
Backend /find   ──► Dynamic MongoDB Aggregation ($facet) based on Category Attributes
Storefront PLP  ──► Auto-renders Category-Specific Filters & Variant Swatches

2. Category-Specific Domain Examples

Category Dynamic Filter Dimensions Variant Options (Product Level)
Fashion / Men's Wear Size, Material/Fabric, Fit, Pattern, Sleeve, Occasion Size + Color Matrix (Red / XL, Blue / M)
Food & Groceries Pack Size / Net Volume, Diet Type (Veg/Non-Veg/Vegan), Organic, Brand Packaging Quantity (200 ml, 500 gms, 1 kg)
Nursery & Plants Plant Type, Sunlight Requirement, Water Requirement, Pot Size, Growth Rate Pot Size & Height (6-inch Pot, 12-inch Pot)
Electronics & Hardware Capacity, Power Source, Warranty, Voltage, Connectivity Storage/Memory (128GB, 256GB, 512GB)

3. Comprehensive 3-Tier Gap Analysis

Tier 1: Category & Sub-Category Schema Gaps (CategorySchema & SubcategorySchema)

Current State: Categories only contain name, slug, pic, subCategories: [String].

Required Missing Parameters (Category Level):

  1. attributeDefinitions [Array of JSON Objects]
    • Defines the exact filterable attributes applicable to all products in this category. json "attributeDefinitions": [ { "key": "size", "label": "Size", "type": "multi-select", "options": ["S", "M", "L", "XL", "XXL"], "isFilterable": true, "isRequired": true }, { "key": "fabric", "label": "Fabric / Material", "type": "select", "options": ["100% Cotton", "Polyester", "Linen", "Denim"], "isFilterable": true }, { "key": "packSize", "label": "Packaging Size", "type": "select", "options": ["200 ml", "500 gms", "1 kg", "5 kg"], "isFilterable": true } ]
  2. variantAttributeKeys [Array of Strings]
    • Specifies which attribute keys trigger SKU variant creation (e.g. ["size", "color"] or ["packSize"]).

Tier 2: Product Level Schema Gaps (productSchema)

Current State: Products have fixed fields (price, quantity, cost, unit, feature: [String]).

Required Missing Parameters (Product Level):

  1. attributes [Object / Map]
    • Dynamic key-value store for product specifications defined by the category template. json "attributes": { "fabric": "100% Cotton", "fit": "Regular Fit", "dietType": "Vegetarian", "origin": "India" }
  2. hasVariants [Boolean]
    • Flags whether the product is a single SKU or has multiple purchasable options.
  3. variantType [String]
    • E.g., "size_color", "pack_size", "weight", "volume".
  4. defaultVariantId [String / ObjectId]
    • Specifies which variant price/image to show by default on the product listing page.

Tier 3: Product Variant (SKU) Level Gaps (variantSchema)

Current State: No variant schema exists. Multi-option products (like 200ml, 500g, 1kg) must currently be created as separate standalone products.

Required Missing Parameters (Variant Level):

"variants": [
  {
    "_id": "var_601a9b...",
    "sku": "CAD-DM-200ML",
    "title": "200 ml Pack",
    "variantAttributes": {
      "packSize": "200 ml"
    },
    "price": 2.50,
    "offerPrice": 2.00,
    "finalPrice": 2.00,
    "stockQuantity": 150,
    "images": ["/images/products/cadbury-200ml.jpg"],
    "isDefault": true
  },
  {
    "_id": "var_601a9c...",
    "sku": "CAD-DM-500G",
    "title": "500 gms Pack",
    "variantAttributes": {
      "packSize": "500 gms"
    },
    "price": 5.50,
    "offerPrice": 4.80,
    "finalPrice": 4.80,
    "stockQuantity": 80,
    "images": ["/images/products/cadbury-500g.jpg"],
    "isDefault": false
  }
]

Tier 4: Backend Search & Faceting API Gaps (/v1/comm/find)

Current State: /v1/comm/find returns hardcoded facets (type, plantType, color, brand, tags).

Required Backend Modifications:

  1. Dynamic $facet Aggregation:
    • When /v1/comm/find?catId=123 is queried, read Category.attributeDefinitions for catId.
    • Aggregate $match products under catId and dynamically group by $attributes.<key> for each defined attribute key.
  2. Filter Query Pipeline:
    • Accept dynamic filter queries: v1/comm/find?catId=123&attr_size=XL&attr_packSize=500gms.

4. E-Commerce & Business Justification (Customer & Sales POV)

Gap / Missing Parameter Customer POV Problem Business & Sales Impact
No Dynamic Category Attributes Customers searching for Men's Wear see generic plant/flower filters or empty filter lists. Increases bounce rate by 35% due to irrelevant search filters.
No Variant Management (Pack Sizes / Sizes) Shoppers have to search separate product pages for 200ml vs 1kg packs. Lowers Average Order Value (AOV); shoppers miss bulk options.
No Variant Stock Tracking Customer orders Size 'M' only to find out post-checkout that 'M' was out of stock. Increases order cancellations and customer support tickets.
No Dynamic Facets API Hardcoded facets clutter the sidebar with irrelevant options (e.g. showing "Plant Type" for T-Shirts). Frustrates shoppers and lowers mobile conversion rates.

5. Technical Implementation Roadmap for Engineering Team

PHASE 1: DB Models & Schema Updates (Backend)
├── Update Categories-model.js to support attributeDefinitions array
├── Update productModel.js to include attributes Map & variants Sub-document array
└── Add Database Indexing on categoryId + attributes.<key>

PHASE 2: Admin Panel Configurator (Backend Admin)
├── Category Management: Add Dynamic Attribute Configurator UI (Add Key, Label, Type, Options)
└── Product Management: Add Variant Matrix Builder (Set prices, SKUs, and stock per variant)

PHASE 3: Search & Facet Engine Updates (/v1/comm/find API)
├── Dynamic MongoDB $facet pipeline driven by Category.attributeDefinitions
└── Filter processing for attr_* parameters in URL query string

PHASE 4: Storefront UI Integration (Frontend)
├── Update FilteredProducts.tsx to render category-specific facets dynamically
└── Update ProductUnifiedCard.tsx & ProductDetailsModal.tsx to include Variant Selectors (Pack Size / Size pills)

6. Next Steps & Action Items for Tech Lead

  1. Schema Sign-off: Review the proposed attributeDefinitions, attributes, and variants schema fields.
  2. API Contract Agreement: Confirm query parameter format for dynamic filters (e.g. attr[size]=XL vs attr_size=XL).
  3. Phase 1 Execution: Prepare MongoDB migration script for category attribute templates and product variants.
(1-1/3)