I am having the same issue as outlined here but the solutions below do not work. I do have "Commerce Product Option" enabled.
I also alter the price using this hook,
function mectronic_get_amount_qty($price, $length) {
//print '<pre>P ' . print_r($price, 1) . '</pre>';
//print '<pre>L ' . print_r($length, 1) . '</pre>';
if ($length >= 1 && $length <= 5) return $price;
elseif ($length >= 6 && $length <= 10) return $price * (1 - 0.166666667);
elseif ($length > 10) return $price * (1 - 0.285714286);
}
I have tried
$entity->commerce_pricing_attributes[$set_id['set_id']][$field_name] = $price;
As in #4 but it does not work.
https://www.drupal.org/node/2056711#comment-9474069
Use hook_commerce_cart_product_comparison_properties_alter() to unset 'commerce_pricing_attributes' property.
In case, your need your line-items to be distinguished by this property. I suggest you to utilise Rules module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With