I am trying to add new product to cart with ajax method and I would like to know that how am I able to save customization fields data into a product meta? What parameters should I use to save that data on ajax data parameter? So when I call the request it should add to cart with customization fields data.
Here is my currrent code:
$('.cart_data').click(function(){ var static_token = $('input[name=token]').val(); var id_product = $('input[name=id_product]').val(); var formActionAttribute_name_field = $("input[name=textField191]").attr("name"); var formActionAttribute_value_field = $('input[name=textField191]').val(); $.ajax({ type: 'POST', headers: { "cache-control": "no-cache" }, url: prestashop.urls.pages.cart, async: false, cache: false, dataType : "json", data: {'action': 'add-to-cart', 'add': 1, 'ajax': true, 'qty': 1, 'id_product': id_product, 'token': static_token, formActionAttribute_name_field: formActionAttribute_value_field}, success: function(jsonData,textStatus,jqXHR) { ajaxCart.updateCartInformation(jsonData, true); console.log(jsonData); } }); });
Thanks in Advance