The configurations can be removed in the following way.
Here is an example snippet for the same:
Entity form display and Entity view display control which fields are shown in the entity creation form and entity display page. Drupal provides complete control of fields and widgets through the user interface. We can also set these settings programmatically by loading the correct configuration.
So when we run this snippet body field is removed from the form display while creating a product of product type default. Feel free to experiment by setting other available configurations in the configuration file of the type entity view display an entity form display.
Drupal 8 provides configuration manager module which helps in managing configuration across the various environment of the same website, the configuration can be fetched and altered in a custom module in following way.
//Fetching Site Name using configuration. $site_name = \Drupal::config('system.site')->get('name'); //To edit configuration as well use getEditable method. $config = \Drupal::service('config.factory')->getEditable('system.site'); // Setting DrupalABC as Sitename. $config->set('name', 'DrupalABC')->save();