Révision 0f8e34f8
Ajouté par Assos Assos il y a presque 7 ans
drupal7/sites/all/modules/commerce/modules/product_pricing/commerce_product_pricing.api.php | ||
---|---|---|
75 | 75 |
$line_item->order_id = commerce_cart_order_id($user->uid); |
76 | 76 |
} |
77 | 77 |
} |
78 |
|
|
79 |
/** |
|
80 |
* Allow modules to alter the product line item during sell price calculation |
|
81 |
* when the "Product pricing process" is configured to either "rules_invoke_all" |
|
82 |
* or "module_invoke_all". |
|
83 |
* |
|
84 |
* @param $line_item |
|
85 |
* The product line item used for sell price calculation. |
|
86 |
*/ |
|
87 |
function hook_commerce_product_calculate_sell_price($line_item) { |
|
88 |
$line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item); |
|
89 |
$product = $line_item_wrapper->commerce_product->value(); |
|
90 |
|
|
91 |
// If the product is not published, nullify the line item's unit price. |
|
92 |
if (!$product->status) { |
|
93 |
$line_item_wrapper->commerce_unit_price->amount = NULL; |
|
94 |
return; |
|
95 |
} |
|
96 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules