Where are the add to cart form settings?
Turn on the Combine options in your Line Item displays and Product displays.

If you use Commerce lisense module please check this issue Commerce license does not combine line items

If not I guess this link can be helpful , you will find example of hook_commerce_cart_product_comparison_properties_alter()