How to use inline_entity_form in Drupal 8?
In order to implement Inline Entity form in D8, all you need to do is set your entity reference field to use the IEF widget - simple or complex. That is all. No additional work.

Here is how we set it up in Drupal Commerce for products, programmatically.

$form_display = commerce_get_entity_display('commerce_product', $product_type-&gt;id(), 'form');
$form_display-&gt;setComponent('variations', [
  'type' =&gt; 'inline_entity_form_complex',
  'weight' =&gt; 10,
  'settings' =&gt; [
    'override_labels' =&gt; TRUE,
    'label_singular' =&gt; 'variation',
    'label_plural' =&gt; 'variations',
  ],
]);
$form_display-&gt;save();


This tells the variations field, which is a Product Variation entity reference, to use IEF as the way to manage field values.