How to programmatically create a configurable Magento 2 product

- Magento 2

Magento 2 Development

If the simple and configurable products are not assigned together like in the folowing example, there is a reliable solution.

You can review on API functional test aimed at creating configurable product. You code should have the following look:

It is also necessary to mention that the API does not generate simple product, so there is the need to create in advance.

More tips from Magento 2 Developer’s Cookbook

'

Source (Magento Stackexchange Question) (mmmgigi and KAndy)

'