function hook_commerce_cart_product_comparison_properties_alter in Commerce Core 7
Allows modules to add additional property names to an array of comparison properties used to determine whether or not a product line item can be combined into an existing line item when added to the cart.
Parameters
&$comparison_properties: The array of property names (including field names) that map to properties on the line item wrappers being compared to check for combination.
$line_item: A clone of the line item being added to the cart. Since this is a clone, changes made to it will not propagate up to the Add to Cart process.
1 invocation of hook_commerce_cart_product_comparison_properties_alter()
- commerce_cart_product_add in modules/
cart/ commerce_cart.module - Adds the specified product to a customer's shopping cart.
File
- modules/
cart/ commerce_cart.api.php, line 219 - Hooks provided by the Cart module.
Code
function hook_commerce_cart_product_comparison_properties_alter(&$comparison_properties, $line_item) {
// Force separate line items when the same product is added to the cart from
// different display paths.
$comparison_properties[] = 'commerce_display_path';
}