You are here

function uc_cart_node_delete in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_cart/uc_cart.module \uc_cart_node_delete()

Implements hook_node_delete().

File

uc_cart/uc_cart.module, line 250

Code

function uc_cart_node_delete($node) {
  if (uc_product_is_product($node->type)) {
    $efq = new EntityFieldQuery();
    $result = $efq
      ->entityCondition('entity_type', 'uc_cart_item')
      ->propertyCondition('nid', $node->nid)
      ->execute();
    if (!empty($result['uc_cart_item'])) {
      entity_delete_multiple('uc_cart_item', array_keys($result['uc_cart_item']));
    }
  }
}