You are here

function uc_product_node_delete in Ubercart 8.4

Implements hook_node_delete().

File

uc_product/uc_product.module, line 210
The product module for Ubercart.

Code

function uc_product_node_delete($node) {
  if (!uc_product_is_product($node)) {
    return;
  }
  $features = uc_product_feature_load_multiple($node
    ->id());
  foreach ($features as $feature) {
    uc_product_feature_delete($feature->pfid);
  }
  $connection = \Drupal::database();
  $connection
    ->delete('uc_products')
    ->condition('nid', $node
    ->id())
    ->execute();
}