I have been looking at different previous posts and clearly, I can’t see a solution on how to use the addTocart API. I am trying to add customtextfields to products being added to cart. The API reference can only the product without the values on customTextFields. How can I modify to also include these info?
Lapel_Type :{ customTextFields :
[{ value : “Lapel_Type” ,
description : lapeltype ,
inStock : true ,
visible : true ,
mainMedia : null ,
mediaItems :[]}]},
Jacket_Pockets :{ customTextFields :
[{ value : “Jacket_Pockets” ,
description : jacketpockets ,
inStock : true ,
visible : true ,
mainMedia : null ,
mediaItems :[]}]},
Pick_Stitching :{ customTextFields :
[{ value : “Pick_Stitching” ,
description : pickstitching ,
inStock : true ,
visible : true ,
mainMedia : null ,
mediaItems :[]}]},
$w ( ‘#shoppingCartIcon1’ ). addToCart ( productId , 1 , selectedOptions )
. then ( () => {
console . log ( “Product added” );
} )
. catch ( ( error ) => {
console . log ( error );
} );
}
Any suggestions will be appreciated!