Yes. Here is a node sample for adding new variants to an existing product. The caveat is that you have to populate the variants array with the ids of the variants you want to keep:
var https = require('https');
var cred = new Buffer("xxx:yyy").toString('base64');
var headers = {Authorization: "Basic "+cred, "Content-Type": "application/json"};
var productId = 1925263361;
var options = {
host: 'kotntest1.myshopify.com',
port: 443,
path: '/admin/products/'+productId +'.json',
method: 'PUT',
headers: headers
};
// Setup the request. The options parameter is
// the object we defined above.
var req = https.request(options, function(res) {
res.setEncoding('utf-8');
var responseString = '';
res.on('data', function(data) {
responseString += data;
//console.log(data);
});
res.on('end', function() {
var resultObject = JSON.parse(responseString);
console.dir(resultObject);
});
});
req.on('error', function(e) {
// TODO: handle error.
console.log(e);
});
var product = {
product:{
id: productId,
variants: [
{
id:5991257025 //existing variant id
},
{
id:5991257089 //existing variant id
},
{
id:19762423495 //existing variant id
},
// new variant details
{
title:'v4', // new variant details
option1: 'green',
option2: "Honda",
option3: 'Civic'
},{
title:'v5',
option1: 'pink',
option2: "Honda",
option3: 'Civic'
},{
title:'v6',
option1: 'yellow',
option2: "Honda",
option3: 'Civic'
},{
title:'v7',
option1: 'brown',
option2: "Honda",
option3: 'Civic'
}
]
}
};
req.write(JSON.stringify(product));
req.end();