/Ecommerce-Wp

Ecommerce Website for WhatsApp Business Model

Primary LanguageHTML

Ecommerce-Wp

Ecommerce Website for WhatsApp Business Model

Star the repo to show support

Setup

Go to Google sheets

image

Make sheet name like this

image

Open App Script paste this code

function doGet(e) {
  var sheet =SpreadsheetApp.getActive();
  var nse =sheet.getSheetByName("Sheet1");
  var data = [];
  var rlen = nse.getLastRow();
  var clen = nse.getLastColumn();
  var rows = nse.getRange(1,1,rlen,clen).getValues();
  for(var i =1 ;i< rows.length ; i++){
    var datarow = rows[i];
    var record = {};
    for(var j=0;j<clen ;j++){
      record[rows[0][j]] =datarow[j];
    }
    data.push(record);
  }
  console.log(data);
  var result =JSON.stringify(data);
  return ContentService.createTextOutput(result).setMimeType(ContentService.MimeType.JSON);
}
var sheet =SpreadsheetApp.getActive();
var nse =sheet.getSheetByName("Sheet1");
function doPost(e) {
 

  var action = e.parameter.action;
  var pass = e.parameter.pass;
  if(pass=="E N T E R   Y O U R    P A S S W O R D" && action =="addUser"){
    return addUser(e);
  }
  else{
    return ContentService.createTextOutput("error").setMimeType(ContentService.MimeType.TEXT);
  }
  

} 

function addUser(e){
  var user = JSON.parse(e.postData.contents);

  nse.appendRow([user.picture,user.name,user.price,user.category,user.tags]);

  return ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT);

}

Click Deploy New Deployment

image

keep the same settings

image

follow the steps and get this link

image

open code in visual studio code and replace the link

Deploy on github or extrenal clients done