Recent Posts


Large Configurable Products in Magento 2


Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

Magento 2, like its forbearers, starts to fall apart when you push larger amounts of data through its systems. One example of this is Configurable Products. Configurable Products allow users to pick options for a product (size, color, etc.), and have each configuration mapped onto a single Simple Product entity. In theory, there’s no limit on the number of simple products you can link to a configurable. In practice, Magento’s UI rendering code starts to choke when the number of simple products attached to a configurable product starts getting into the thousands. Certainly not the standard case, but its not exactly an uncommon use case for Magento users.

The elgentos/LargeConfigProducts module takes a stab at fixing this. From the README

In the frontend, Magento 2 loads all variations (associated simple products) in a giant JSON object and renders that into the DOM. This JSON object is 20 megabytes for 10k variations.

In the backend, this JSON is also built and passed to a UI component wrapped in XML. PHP’s xmllib is not able to append extremely large XML structures to an existing XML structure.

We have created workaround for both problems. In the frontend, we offload fetching the JSON blob through an AJAX request.

In the backend we use DOMDocument’s and the LIBXML_PARSEHUGE constant to handle the extremely large XML structure.

Copyright © Alan Storm 1975 – 2021 All Rights Reserved

Originally Posted: 29th January 2018