Variants
Purpose
The Variants collection contains detailed records for each product variant. Each document includes information such as color, size, codes, posters, 3D/AR model links (for both .glb and .usdz file formats), and references to related products, brands, and tags. This collection supports the management, configuration, and display of all available product variations.
Document schema
{
"batch": "string",
"dataTaken": "boolean",
"eanCode": "string",
"frameColor": "string",
"glassesName": "string",
"id": "string",
"lastUpdate": "timestamp",
"lensesColor": "string",
"list_notes": ["string"],
"list_size_color_tags": ["string"],
"loadingId": "string",
"mainBrandRef": "string",
"mainModel": "boolean",
"modelPriority": "string",
"modelViewerUrl": "string",
"modify_model": {
"rejectCount": "number",
"requestCount": "number",
"status": "boolean"
},
"poster": "string",
"poster2": "string",
"poster3": "string",
"poster4": "string",
"posterNoBackground": "string",
"primaryFrameColorHex": "string",
"primaryLensesColorHex": "string",
"priority": "number",
"productRef": "string",
"secondaryFrameColorHex": "string",
"secondaryLensesColorHex": "string",
"size": {
"bridge": "string",
"frameWidth": "string",
"lensHeight": "string",
"lensWidth": "string",
"size": "string",
"templeLength": "string"
},
"skuModel": "string",
"status": "string",
"templeColor": "string",
"upcCode": "string",
"urlDE": "string",
"urlES": "string",
"urlFR": "string",
"urlGlobal": "string",
"urlGlobalComplete": "string",
"urlGlobalCompleteSize": "number",
"urlGlobalSize": "number",
"urlProductPage": "string",
"urlUsdz": "string",
"urlUsdzComplete": "string",
"urlUsdzCompleteSize": "number",
"urlUsdzSize": "number",
"variantCode": "string"
}
Indexes
- id is a
stringthat refers to the specific ID of a document of this collection; - list_notes is a
[]ofstrings that refer to the IDs of theValidationNotescollection; - list_size_color_tags is a
[]ofstrings that refer to the IDs of theTagscollection; - mainBrandRef is a
stringthat refers to the ID of theMainBrandscollection; - productRef is a
stringthat refers to the ID of theProductscollection.
Query examples
// Fetch the Variant Reference Doc from Firebase
const variantRef = doc(db, "Variants", variantId);
// Get the Document Snapshot from the Variant Reference Doc
const variantDoc = await getDoc(variantRef);
// Query to fetch a variant by skuModel field
const variantBySku = query(collection(db, "Variants"), where("skuModel", "==", skuValue));