Product object is required for revenue tracking, recommendation engine, and campaigns such as cart reminder. This article explains how you can set the product object and product attributes.
Set product object
Once you create a product object, you can set its attributes. You can set predefined (e.g., color, size, voucher name, sub-category, etc.) and custom attributes.
The following parameters are required for the product object:
| Parameter | Data Type |
|---|---|
| productID | String |
| name | String |
| taxonomy | Array (of string) |
| imageURL | String |
| price | Double |
| currency | String |
Method Signature
static createNewProduct(
productID: string,
name: string,
taxonomy: Array<string>,
imageURL: string,
price: number,
currency: string
)Method Example
const taxonomy = ['taxonomy1', 'taxonomy2', 'taxonomy3'];
let insiderExampleProduct = RNInsider.createNewProduct(
'productID',
'productName',
taxonomy,
'imageURL',
1000.5,
'currency',
);Set color attribute
This method allows you to set the color attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| color | String |
Method Signature
setColor(color: string)Method Example
insiderExampleProduct.setColor('color');Set voucher name attribute
This method allows you to set the voucher name attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| voucherName | String |
Method Signature
setVoucherName(voucherName: string)Method Example
insiderExampleProduct.setVoucherName('voucherName');Set voucher discount attribute
This method allows you to set the voucher discount attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| voucherDiscount | Double |
Method Signature
setVoucherDiscount(voucherDiscount: number)Method Example
insiderExampleProduct.setVoucherDiscount(10.5);Set promotion name attribute
This method allows you to set the promotion name attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| promotionName | String |
Method Signature
public InsiderProduct setPromotionName(String promotionName)Method Example
insiderExampleProduct.setPromotionName('promotionName');Set promotion discount attribute
This method allows you to set the promotion discount attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| promotionDiscount | Double |
Method Signature
setPromotionDiscount(promotionDiscount: number)Method Example
insiderExampleProduct.setPromotionDiscount(10.5);Set GroupCode attribute
This method allows you to set the groupcode of your Insider product object.
| Parameter | Data Type |
|---|---|
| groupcode | String |
Method Signature
setGroupCode(groupcode: string)Method Example
insiderExampleProduct.setGroupCode("XXXX")Set size attribute
This method allows you to set the size attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| size | String |
Method Signature
setSize(size: string)Method Example
insiderExampleProduct.setSize('size');Set sale price attribute
This method allows you to set the sale price attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| salePrice | Double |
Method Signature
setSalePrice(salePrice: number)Method Example
insiderExampleProduct.setSalePrice(10.5);Set shipping cost attribute
This method allows you to set the shipping cost attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| shippingCost | Double |
Method Signature
setShippingCost(shippingCost: number)Method Example
insiderExampleProduct.setShippingCost(10.5);Set quantity attribute
This method allows you to set the quantity attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| quantity | Integer |
Method Signature
setQuantity(quantity: number)Method Example
insiderExampleProduct.setQuantity(10);Set stock attribute
This method allows you to set the stock attribute of your Insider product object.
| Parameter | Data Type |
|---|---|
| stock | Integer |
Method Signature
setStock(stock: number)Method Example
insiderExampleProduct.setStock(10);Set brand attribute
This method allows you to set the brand of your Insider product object.
Method Signature
setBrand(brand: string)Method Example
insiderExampleProduct.setBrand('Nike');Set stock keeping unit attribute
This method allows you to set the stock keeping unit of your Insider product object.
Method Signature
FlutterInsiderProduct setSku(String sku)Method Example
insiderExampleProduct.setSku("SKU123456");Set gender attribute
This method allows you to set the gender of your Insider product object.
Method Signature
FlutterInsiderProduct setGender(String gender)Method Example
insiderExampleProduct.setGender("male");Set multipack attribute
This method allows you to set the multipack of your Insider product object.
Method Signature
FlutterInsiderProduct setMultipack(String multipack)Method Example
insiderExampleProduct.setMultipack("2-pack");Set product type attribute
This method allows you to set the product type of your Insider product object.
Method Signature
FlutterInsiderProduct setProductType(String productType)Method Example
insiderExampleProduct.setProductType("Footwear");Set global trade item number attribute
This method allows you to set the global trade item number of your Insider product object.
Method Signature
FlutterInsiderProduct setGtin(String gtin)Method Example
insiderExampleProduct.setGtin("1234567890123");Set description attribute
This method allows you to set the description of your Insider product object.
Method Signature
FlutterInsiderProduct setDescription(String description)Method Example
insiderExampleProduct.setDescription("Breathable running shoes");Set tags attribute
This method allows you to set the tags of your Insider product object.
Method Signature
FlutterInsiderProduct setTags(List<String> tags)Method Example
List<String> tags = List(3);
tags[0] = "running";
tags[1] = "summer";
tags[2] = "discount";
insiderExampleProduct.setTags(tags);Set custom string attribute
This method allows you to set the custom string attribute for your Insider product object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | String |
Method Signature
setCustomAttributeWithString(key: string, value: string)Method Example
insiderExampleProduct.setCustomAttributeWithString('key', 'value');Set custom integer attribute
This method allows you to set the custom integer attribute for your Insider product object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Integer |
Method signature
setCustomAttributeWithInt(key: string, value: number)Method Example
insiderExampleProduct.setCustomAttributeWithInt('key', 10);Set custom boolean attribute
This method allows you to set the custom boolean attribute for your Insider product object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Boolean |
Method Signature
setCustomAttributeWithBoolean(key: string, value: boolean)Method Example
insiderExampleProduct.setCustomAttributeWithBoolean('key', true);Set custom double attribute
This method allows you to set the custom double attribute for your Insider product object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Double |
Method Signature
setCustomAttributeWithDouble(key: string, value: number)Method Example
insiderExampleProduct.setCustomAttributeWithDouble('key', 10.5);Set custom date attribute
This method allows you to set the custom date attribute for your Insider product object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Date object |
Method Signature
setCustomAttributeWithDate(key: string, value: Date)Method Example
insiderExampleProduct.setCustomAttributeWithDate('key', new Date());Set custom array of string attribute
This method allows you to set the custom array of string attribute for your Insider product object.
| Parameter | Data Type |
|---|---|
| key | String |
| value | Array (of string) |
Method Signature
setCustomAttributeWithStringArray(key: string, value: Array<string>): InsiderProductMethod Example
const stringArray = ['value1', 'value2', 'value3'];
insiderExampleProduct.setCustomAttributeWithStringArray('key', stringArray);Set custom array of number attribute
This method allows you to set the custom array of number attribute for your Insider product object.
| Parameter | Data Type |
|---|---|
| key | Number |
| value | Array (of number) |
Method Signature
setCustomAttributeWithNumericArray(key: string, value: Array<number>): InsiderProductMethod Example
const numberArray = [5, 3.14, 100];
insiderExampleProduct.setCustomAttributeWithNumericArray('key', numberArray);