function commerce_cps_entity_update in Commerce Cart Pane 7
Implements hook_entity_update().
File
- modules/
shipping/ commerce_cps.module, line 105
Code
function commerce_cps_entity_update($entity, $entity_type) {
// use this hook when line item has been updated.
// Use cases:
// * on Cart form after changing Quantity and clicking
// "Update cart" button
// * on Product form after clicking on "Add to cart" button if product
// already has been added in the cart.
if ($entity_type == 'commerce_line_item') {
$bundle = $entity->type;
$product_types = commerce_product_types();
$product_types = array_keys($product_types);
if (in_array($bundle, $product_types)) {
global $user;
$cart_order = commerce_cart_order_load($user->uid);
commerce_cps_add_order_shipping($cart_order);
}
}
}