Separate line items when line item details are different
You could first have a look at Commerce Product Add-on module. That solution would split them per product type e.g. if you add one product with gift wrapping and one without you will have one line item for the product with quantity 2 and one for the gift wrapping with quantity 1. This gives the customer visibility of the exact pricing.

If however you still want to do it the way you described, the hook you mentioned should work.

function MY_MOULE_commerce_cart_product_comparison_properties_alter(
  &amp;$comparison_properties,
  $line_item
) {                                                                                                                                                                                                                
  $comparison_properties[] = 'field_wrapping_option';
}


Possible cause of trouble would be if the 'field_wrapping_option' of the line item being added is not set at all. The existing line item would always have the field set, even with an empty value, while you will have to set it for the incoming line item. It is possible that you set the field value only when gift wrapping is selected, try setting the field value to NULL if no gift wrapping is selected.

$line_item_wrapper-&gt;field_wrapping_option-&gt;set(NULL);


To further debug why line items are not properly combined, look at the 'commerce_cart_product_add' function at the commerce_cart.module file. The following code is the most relevant.

// Loop over each line item on the order.                                                                                                                                                                                                
foreach ($order_wrapper-&gt;commerce_line_items as $delta =&gt; $matching_line_item_wrapper) {
  // Examine each of the comparison properties on the line item.                                                                                                                                                                         
  foreach ($comparison_properties as $property) {
    // If the property is not present on either line item, bypass it.                                                                                                                                                                    
    if (!isset($matching_line_item_wrapper-&gt;value()-&gt;{$property}) &amp;&amp; !isset($line_item_wrapper-&gt;value()-&gt;{$property})) {
      continue;
    }

    // If any property does not match the same property on the incoming line                                                                                                                                                             
    // item or exists on one line item but not the other...                                                                                                                                                                              
    if ((!isset($matching_line_item_wrapper-&gt;value()-&gt;{$property}) &amp;&amp; isset($line_item_wrapper-&gt;value()-&gt;{$property})) ||
      (isset($matching_line_item_wrapper-&gt;value()-&gt;{$property}) &amp;&amp; !isset($line_item_wrapper-&gt;value()-&gt;{$property})) ||
      $matching_line_item_wrapper-&gt;{$property}-&gt;raw() != $line_item_wrapper-&gt;{$property}-&gt;raw()) {
      // Continue the loop with the next line item.                                                                                                                                                                                      
      continue 2;
    }
  }

  // If every comparison line item matched, combine into this line item.                                                                                                                                                                 
  $matching_line_item = $matching_line_item_wrapper-&gt;value();
  break;
}