createNewProduct
This method creates a new product object.
Name | Type | Description | Required |
|---|---|---|---|
id | String | Product identifier | Yes |
name | String | Product name | Yes |
taxonomy | [String] | Product categories | Yes |
url | String | Product image URL | Yes |
price | Double | Product price | Yes |
currency | String | Product currency | Yes |
InsiderProduct createNewProduct(
string id,
string name,
[string] taxonomy,
string url,
double price,
string currency
)const product = window.insider.createNewProduct(
'productId',
'productName',
['male', 't-shirt'],
'https://localhost/1234/shirt_1.png',
123.45,
'USD'
)Product attributes
You can use the following methods to attach attributes to the product.
Parameter | Type | Required |
|---|---|---|
setColor | String | Yes |
setVoucherName | String | Yes |
setPromotionName | String | Yes |
setSize | String | Yes |
setGroupCode | String | Yes |
setSalePrice | Double | Yes |
setShippingCost | Double | Yes |
setVoucherDiscount | Double | Yes |
setPromotionDiscount | Double | Yes |
setStock | Integer | Yes |
setQuantity | Integer | Yes |
setBrand | String | Yes |
setGender | String | Yes |
setDescription | String | Yes |
setSku | String | Yes |
setMultipack | String | Yes |
setProductType | String | Yes |
setGtin | String | Yes |
setTags | [String] | Yes |
setInStock | Boolean | Yes |
setProductURL | String | Yes |
Method example
const product = window.insider.createNewProduct(
'productId',
'productName',
['male', 't-shirt'],
'https://localhost/1234/shirt_1.png',
123.45,
'USD'
)
product
.setColor('Red')
.setVoucherName('SUMMER2024')
.setPromotionName('Summer Sale')
.setSize('XL')
.setGroupCode('GROUP-001')
.setSalePrice(99.99)
.setShippingCost(5.5)
.setVoucherDiscount(10.0)
.setPromotionDiscount(15.0)
.setStock(50)
.setQuantity(2)
.setBrand('Insider Brand')
.setGender('Unisex')
.setDescription('Premium quality product with amazing features')
.setSku('SKU-12345')
.setMultipack('multipack')
.setProductType('Electronics')
.setGtin('1234567890123')
.setTags(['new', 'featured', 'bestseller'])
.setInStock(true)
.setProductURL("https://www.insiderone.com");