diff --git a/modules/contrib/commerce/commerce.module b/modules/contrib/commerce/commerce.module
index 1c367a58..d19b6533 100644
--- a/modules/contrib/commerce/commerce.module
+++ b/modules/contrib/commerce/commerce.module
@@ -8,7 +8,7 @@
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Render\Element;
-
+use Drupal\Core\Database\Database;
 /**
  * Implements hook_toolbar_alter().
  */
@@ -132,3 +132,77 @@ function _commerce_entity_theme_suggestions($entity_type_id, array $variables) {
 
   return $suggestions;
 }
+
+/**
+ * Implements hook_form_alter().
+ * @param $form
+ * @param FormStateInterface $form_state
+ * @param $form_id
+ */
+function commerce_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id){
+  $form_ids = [
+    'commerce_product_default_delete_form',
+    'commerce_product_group_delete_form'
+  ];
+  if (in_array($form_id , $form_ids)) {
+    $form['#validate'][] = '_product_variations_validate';
+  }
+}
+
+/**
+ * Verify product_variations, do not delete if it is referenced by more than one entity.
+ * @param $form
+ * @param FormStateInterface $form_state
+ */
+function _product_variations_validate(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
+
+  $entity            = $form_state -> getFormObject() -> getEntity();
+  $product_title     = $entity -> getTitle();
+  $product_entity_id = $entity -> id();
+  // Get all variations_target_id for entity
+  $target_ids        = _query_data ($product_entity_id,'entity_id','variations_target_id');
+
+  foreach ($target_ids as $target_id) {
+    // Get all the entities for variations_target_id
+    $entity_ids = _query_data ($target_id,'variations_target_id','entity_id');
+    // Do not delete variations if it is referenced by more than one entity.
+    if (count($entity_ids) > 1) {
+      $connection = Database::getConnection();
+      $delete_target_id = $connection -> delete('commerce_product__variations')
+        -> condition('entity_id', $product_entity_id)
+        -> condition('variations_target_id', $target_id);
+      $delete_target_id -> execute();
+      drupal_flush_all_caches();
+    }
+  }
+  // Delete this entity and jump to the products list page
+  $storage_handler = \Drupal::entityTypeManager()->getStorage('commerce_product');
+  $entity          = $storage_handler -> load($product_entity_id);
+  $storage_handler -> delete([$entity]);
+
+  drupal_set_message('The product '. $product_title .' has been deleted.');
+  $response = new Symfony\Component\HttpFoundation\RedirectResponse('/admin/commerce/products');
+  $response -> send();
+  die;
+}
+
+/**
+ * Helper function for _product_variations_validate().
+ * @param $id
+ * @param $condition_field_name
+ * @param $field_name
+ * @return array
+ */
+function _query_data ($id , $condition_field_name , $field_name) {
+  $connection = Database::getConnection();
+  $query      = $connection -> select('commerce_product__variations', 'v')
+              ->fields('v', array($field_name))
+              ->condition('v.' . $condition_field_name , $id);
+  $data       = $query -> execute();
+  $results    = $data  -> fetchAll(\PDO::FETCH_OBJ);
+  $ids = [];
+  foreach ($results as $row) {
+    $ids[] = $row -> $field_name;
+  }
+  return $ids;
+}
