Interface: IEditorArgumentsExactProductBuilder
Adds the variants of a catalog product. You get it as the argument of the buildProduct callback of setExactProduct.
Methods
addVariant()
ts
addVariant(
productCode: string,
quantity?: number,
codeOverride?: string,
nameOverride?: string
): IEditorArgumentsExactProductBuilder;Adds a product variant from the catalog.
Parameters
| Parameter | Type | Description |
|---|---|---|
productCode | string | Supplier code of the product variant, e.g. '10086021'. |
quantity? | number | Quantity of the variant. |
codeOverride? | string | Variant code to show instead of the catalog one (e.g. your shop's SKU). |
nameOverride? | string | Variant name to show instead of the catalog one. |
Returns
IEditorArgumentsExactProductBuilder
Example
js
window.tronDesigner.setExactProduct('PFC', undefined, (b) => {
b.addVariant('10086021', 100);
b.addVariant('10086055', 50, 'SKU-55', 'Pen, blue');
});addVariants()
ts
addVariants(...variants: ArgAddProductVariant[]): IEditorArgumentsExactProductBuilder;Adds several product variants from the catalog.
Parameters
| Parameter | Type | Description |
|---|---|---|
...variants | ArgAddProductVariant[] | The variants, each with at least productCode (see ArgAddProductVariant). |
Returns
IEditorArgumentsExactProductBuilder
Example
js
window.tronDesigner.setExactProduct('PFC', undefined, (b) =>
b.addVariants({ productCode: '10086021', quantity: 100 }, { productCode: '10086055' })
);