Ajax add to cart response in shopify

Highlighted
Explorer
61 4 4

1 - onclick button 
2- Get variants id and pass in data

$('.bc').click(function(e){
e.preventDefault();
var value = $(this).parent().find('#vari').attr('value');
alert(value);
$.ajax({
type: 'POST',
url: '/cart/add.js',
data: {
quantity: 1,
id: $(this).parent().find('#vari').attr('value')
},
dataType: 'json',
success: function (data) {

console.log(data);

}
});
});

0 Likes