How to modify product attribute and send this product to a basket.


I try to write own plugin that will be working as „calculator“. Customer went to and then after calculation my JavaScript page generate ammount of euro’s qustomer must to pay. In my shop i have a product called „Custom product“ with price per piece = 1€. And when script calculate 12€, plugin should add 12 pieces of this product. For more i have 1 custom string input with comment for this product.

Now i would like to create button „Add to basket“ that will be add to basket this product with 12 quantity and i think that is simple to do by creating simple form with post (just like in product page) but how to submit also this string value with this posistion as attribute5?

I create Free text field in table Order positions (s_order_details_attributes) and when i manualy change this value in DB i see that it posted to backend, but it is manualy :<

 I will be really happy for any advices how to attach this string with Add to basket action