How can I add custom price to cart as an attribute of product type in Drupal Commerce?
In detail am creating a custom tshirt design UI where user have the options to design a tshirt(add image,text etc) and add to cart. I have loaded all the products in the site to the UI and user have the option to add product to cart after designing. User is charged with an extra amount for designing like adding each images to tshirt which increases the base price of tshirt. But my issue is that the products get added to cart with the base price. I have used the folowing code to add the product to cart.
commerce_cart_product_add_by_id($pid, $quan, $combine = TRUE, $uid);
When I searched and found that there is no way to add the custom price as parameter of the above function so that the altered price gets added to cart. But found another solution that it can be done by adding as an attribute of the product.
How can I map the custom price I have created as an attribute of the product and add to cart for altering the price section?