createJSProduct function
dynamic
createJSProduct(
- dynamic mpCommerce,
- dynamic rawProduct
Implementation
createJSProduct(mpCommerce, rawProduct) {
JsObject? getAttributes(attributes) {
if (attributes != null) {
return JsObject.jsify(attributes);
} else {
return null;
}
}
var product = mpCommerce.callMethod('createProduct', [
rawProduct['name'],
rawProduct['sku'],
rawProduct['price'],
rawProduct['quantity'],
rawProduct['variant'],
rawProduct['category'],
rawProduct['brand'],
rawProduct['position'],
rawProduct['couponCode'],
getAttributes(rawProduct['attributes'])
]);
return product;
}