Add a comment to a product

Add a comment to product


Adds a Comment to a product


swat.addComment(options, onSuccess, onError)


Here's an example of how you can use this API to add Comment to a List Item :

// Define the opts
let options = {
  listitemcomments: [
        "txt":"Some item comment",

// Define success callback
let onSuccess = function(commentsObj) { 
  // Executed when comments are successfully added
  console.log("Successfully added Comments to List Item", commentsObj);

// Define error callback
let onError = function(error) {
  // Error is an xhrObject
  console.log("Error while adding Comments to List Item", error);

swat.addComment(options, onSuccess, onError);

API Parameters

optionsobjectAn options object with a List Item Comment Input array
listitemcommentsarrayAn array of List Item Comment Input
onSuccessfunctionCalled when the List Comments are successfully added to the List Item.
onErrorfunctionCalled when there is an error while fetching the List Comments to the List Item.

Success Response

  "listcomments": [],
  "listitemcomments": [
      "cid": "comment-id",
      "txt": "Some new comments",
      "lid": "list-id",
      "empi": 123,
      "epi": 111,
      "cts": 145555555511

Other References

List Item Comment Input

An object containing params required for creating new list item comment

let listItemCommentDef = {
  "lid": "list id", 
  "empi": "Product master id",
  "epi": "Product variant id",
  "txt": "Comment text",
  "cprops": {} // optional param
lidstringYesUnique id of the List to add Comment
empinumber/stringYesProduct master id of the List Item to add Comment
epinumber/stringYesProduct Variant id of the List Item to add Comment
txtstringYesComment content
cpropsobjectoptionalMap of custom fields