Removed type of field left WSOD on product variation type screen

Created on 23 October 2023, 8 months ago
Updated 17 November 2023, 7 months ago

Issue message:
Message TypeError: Drupal\commerce_product\ProductAttributeFieldManager::canDeleteField(): Argument #1 ($attribute) must be of type Drupal\commerce_product\Entity\ProductAttributeInterface, null given

Place:
/product-variation-types/default/edit/display

Final effect:
WSOD

What cause:
Comfort attribute install, set for type and remove module

Fix (add: $attributes[$attribute_id] && in line 127 in file Drupal\commerce_product\ProductAttributeFieldManager::canDeleteField()):

    if (!$variation_type->isNew()) {
      // Disable options which cannot be unset because of existing data.
      foreach ($used_attributes as $attribute_id) {
        if ($attributes[$attribute_id] && !$this->attributeFieldManager->canDeleteField($attributes[$attribute_id], $variation_type->id())) {
          $form['attributes'][$attribute_id] = [
            '#disabled' => TRUE,
          ];
          $disabled_attributes[] = $attribute_id;
        }
      }
    }

Need only add as patch and review for future issue downstream

🐛 Bug report
Status

Fixed

Version

2.36

Component

User experience

Created by

🇵🇱Poland Patryk Padus

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024