Shell script for converting configurable to grouped products


A couple of weeks ago my colleague Attila Fabrik and I had a really complex but interesting task. We had to develop a shell script that converts configurable products to grouped products. Our Magento catalog was special. It contained mostly configurable products and it seemed that using configurable products was a good idea 4 years ago when the shop was set up but the current business conditions were pushing us to look for other, more flexible options.

The script can be downloaded, cloned or installed via MODMAN from:

Below I am showing a configurable product that is about to be converted and the grouped product that is the result of the converted configurable product. Basically, the main difference lies in the manner in which “add to cart” form is rendered.

Configurable product:

Configurable add to cart form

Grouped product:

Grouped add to cart form

Why convert?

So far so good, but you are probably wondering why we’ve ended up with this crazy idea to convert configurable products to grouped products?

1. We needed better control over the prices we showed on the configurable product page.

It’s well known that if we set a special price on an individual simple product, then this price is not shown on the configurable product page and it’s not used when the configurable product is added to the cart – but, this is exactly what we wanted. Having grouped products allowed us to have better price control because we’ve always wanted to use the prices of the linked simple products. As we know, price calculation of configurable products works in a different way. The only problem was that the grouped product renders the simple products in a table rather than in a select box. Changing the rendering from table to select box required minimal front-end work effort, so I am going to skip the explanation how we did it.

We had an extension installed that solved the pricing problems mentioned in point (1) but this extension was rewriting many classes and had many collisions with other extensions. We just wanted to make our shop use as many core features as possible, be more robust and less complex.

But again, why convert?

Why not delete the configurable products and import the same product data but for the grouped product type?

2. We wanted to keep the original products IDs!

Those IDs existed in product review tables, the URL rewrite table, external systems, product list widgets, static blocks, etc. Of course we could delete the configurable products and preserve their IDs for the next grouped products import, but this task was also time-consuming and could require the same amount of effort as converting the products.

What DB table operations are done while running the script?


  • updates type_id value from configurable to grouped
  • updates has_options to 0
  • updates required_options to 0


  • creates required links between grouped and simple products


  • deletes custom options because grouped products don’t have custom options

catalog_product_super_link and catalog_product_super_attribute:

  • deletes all rows related to the converted configurable product


  • deletes EAV catalog attribute values that were valid for the configurable product but are not required for the grouped product


  • creates records that describe how the simple products are positioned on the grouped product page (ordered from lowest to highest price)


  • php shell/convert-configurable2grouped.php convert_all

* After the script completes execution, you will see an information table about which products have been converted.

Reindex the Magento catalog

Example output after the script was run:

Screen Shot 2015-08-13 at 17.48.39

Room for improvement:

So far the script converts all configurable products and doesn’t offer the option to convert a predefined list of configurable products. Basically, I don’t have a problem with this because I really want to convert all configurable products but if you want to use a list of products, please modify the function CeckosLab_Convert_Configurable2Grouped::_getConfigurableProductIds()

The script doesn’t have a function for dry-running in order to show which products are going to  be converted but if the community is interested, we could add such functionality.

The script removes a fixed number of eav attribute values that are redundant for grouped products. Those attribute codes are currently hardcoded inside the shell script because it works with the default attribute sets. The script doesn’t cover the cases where the catalog contains custom created attributes that are associated individually for configurable products but are not available for grouped products.

Special thanks:

Many thanks to my good friends from Inchoo who made it possible for this article to reach many Magneto community members! Many thanks to my colleague Attila Fabrik who made the proof of concept to this script! Many thanks to my Magento Community friend Alexander Turiak who made a very good code review of the shell scrip and suggested that I should show some visual feedback after the scrip gets executed.

If you would like to read more of my Magento articles, please visit my blog.

Your thoughts?

About Tsvetan Stoychev

Owner @ Cecko's Lab

A Magento developer and business owner at Cecko's Lab based in Bulgaria.

Read more posts by Tsvetan / Visit Tsvetan's profile


  1. Hi

    I need to convert grouped product to configurable product.
    Any help would be appreciated.
    Thanks in advance

  2. Thank you, very much!
    I’ve modified it to run only for some specific products and also added a method to update the default qty of each simple product too!
    This saved me a lot of time! Thank you!!!

  3. Hello Tsvetsan,

    I want to convert configurable product into simple products. Please assist me.

    Thanks in advance.

  4. Hi,

    i want to associate configurable product in Group Product .
    is it possible or not ???

    if possible then how ….
    any idea how it should be solved.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.