As an ability the user might choose gift wrapping option for some of his/her products on add to cart form , what I did is creating a new product type called gift wrapping item, so site operators can add different kinds of wrapping options with different prices. I also altered the add to cart form so a new form item is added which gives the costumer the ability to choose a wrapping type, so far so good, user choice then is saved as a line item property (product ID of wrapping option is save in 'field_wrapping_option' which is added to product line item), and wrapping price is added to line item base price.
The problem is raised when user want to add 2 item from same product but he/she wants wrapping only for one of the two. In this case both products are stored in same line item and wrapping price also is added for them both.
I used hook_commerce_cart_product_comparison_properties_alter
to force drupal create different line item when 'field_wrapping_option' are different on line items, but it didn't make things better, now every add to cart operation lead to new line item even when same wrapping option has chosen by user, and even worse situation happens when user first add a product without gift wrapping first and then adds a product with wrapping option which cause the first line item change into a product with gift wrapping.
Now the question is : How to Separate line items when line item details are different?