Create configurable product in Magento programmatically

Following post includes the code that can be used to create a configurable product in Magento.

Brief introduction about configurable product

When adding new products to your Magento store you have the option to select the type of the product. The most basic option is simple product.
That’s just a single item with no specific attributes/options that can be changed by the buyer.
With the configurable product type you can offer an item with some options that can be configured by the customers themselves.
For example, you can sell the same model of shoes that are offered in different colors, sizes, etc. Instead of creating several simple
products for each size of the same shoe model that will be displayed individually on the frontend,
for instance, you can create a configurable product which will allow the customer to select the size before ordering the product.

To understand the code, one must have a basic understanding of how configurable product works in a Magento store.

Continue reading