modules/acm_sku/src/SKUFieldsManager.php
public function removeField($field_code) {
    $config = $this->configFactory->getEditable(self::BASE_FIELD_ADDITIONS_CONFIG);
    $fields = $config->getRawData();

    if (!isset($fields[$field_code])) {
      return;
    }

    $field = $fields[$field_code];
    unset($fields[$field_code]);
    $config->setData($fields)->save();

    $this->entityTypeManager->clearCachedDefinitions();
    $this->entityDefinitionUpdateManager->applyUpdates();

    $fields_removed = [
      $field_code => $field,
    ];

    $this->moduleHandler->invokeAll('acm_sku_base_fields_updated', [$fields_removed, 'remove']);
  }
public function removeField($field_code) {
    $config = $this->configFactory->getEditable(self::BASE_FIELD_ADDITIONS_CONFIG);
    $fields = $config->getRawData();

    if (!isset($fields[$field_code])) {
      return;
    }

    $field = $fields[$field_code];
    unset($fields[$field_code]);
    $config->setData($fields)->save();

    $this->entityTypeManager->clearCachedDefinitions();
    $this->entityDefinitionUpdateManager->applyUpdates();

    $fields_removed = [
      $field_code => $field,
    ];

    $this->moduleHandler->invokeAll('acm_sku_base_fields_updated', [$fields_removed, 'remove']);
  }
public function removeField ( $ field_code ) { $ config = $ this -> configFactory -> getEditable ( self :: BASE_FIELD_ADDITIONS_CONFIG ) ; $ fields = $ config -> getRawData ( ) ; if ( ! isset ( $ fields [ $ field_code ] ) ) { return ; } $ field = $ fields [ $ field_code ] ; unset ( $ fields [ $ field_code ] ) ; $ config -> setData ( $ fields ) -> save ( ) ; $ this -> entityTypeManager -> clearCachedDefinitions ( ) ; $ this -> entityDefinitionUpdateManager -> applyUpdates ( ) ; $ fields_removed = [ $ field_code => $ field , ] ; $ this -> moduleHandler -> invokeAll ( 'acm_sku_base_fields_updated' , [ $ fields_removed , 'remove' ] ) ; }
Remove base field from SKU entity.

Note: Calling function needs to take care of clearing data.

@param string $field_code
Field code to remove.
Remove base field from SKU entity .