can i add product in cart using it's sku number ?

Highlighted
New Member
1 0 0

i am currently using ajax api /cart/add.js to add product in cart

like this

$.ajax({
       type: 'POST', 
       url: '/cart/add.js',
       dataType: 'json', 
       data: {quantity: 1,id: gift_variant_id},
       error:function(){ console.log('error'); }
 });

is there any way i can add product in cart using product sku number ?

because {quantity: 1,sku: sku_number} is not working

0 Likes
Shopify Staff
Shopify Staff
1552 77 232

SKUs are not forced to be unique. Since you can't use a SKU as a definitive way to point to a single variant, you have to use variant IDs instead.

 

Cheers.

0 Likes