Magento 2 module for stores with very large configurable products.
Magento normally renders configurable product variation data as a large JSON blob inside the product page HTML. For products with thousands of associated simple products, that payload can become very large and make product pages slow or unreliable.
This module moves that configurable product option JSON out of the initial HTML and loads it asynchronously on the frontend. The generated JSON can also be prewarmed and stored in Redis so customers do not have to wait for Magento to build the payload on first page view.
Current maintained fork target:
- Magento Open Source / Adobe Commerce 2.4.x
- PHP 8.1+
- RabbitMQ-backed Magento message queue for automatic prewarming
- Redis for cached configurable option JSON
The original module was written for older Magento 2 versions. This fork has been refreshed for modern Magento 2.4/PHP 8 compatibility, but it still overrides Magento configurable/swatch frontend internals, so it should be regression-tested when upgrading Magento.
- Avoids embedding huge configurable product JSON directly in product page HTML.
- Reduces initial PDP payload size for large configurable products.
- Allows large option JSON to be cached in Redis.
- Provides a CLI prewarm command for known large configurable products.
- Provides a queue consumer path so changed configurable products can be prewarmed after save/index events.
- Keeps the backend XML/template handling workaround for very large generated XML payloads via
LIBXML_PARSEHUGE.
On configurable product pages, the option wrapper initially renders a lightweight loading state.
The frontend mixins then request:
lcp/fetch/productOptions?productId=<id>
If the request succeeds:
- the cached/generated configurable product JSON is applied to Magento's configurable or swatch renderer;
- the options fieldset is shown;
- normal Magento option selection and add-to-cart behaviour continues.
If the request fails:
- the loading state is replaced with a translated error message;
- the page no longer leaves the customer with an endless spinner.
Generated product option JSON is stored by store, product and customer group:
LCP_PRODUCT_INFO_<store_id>_<product_id>_<customer_group_id>
If customer-group caching is disabled in module configuration, group 0 is used.
Admin path:
Stores > Configuration > Elgentos > LargeConfigProducts
Important settings:
- Absolute Path: Magento root used by the queue consumer when launching the CLI prewarmer.
- Redis Host
- Redis Port
- Redis Database Index
- Enable cache per customer group
Prewarm all configurable products:
php bin/magento lcp:prewarmPrewarm selected product IDs:
php bin/magento lcp:prewarm --products 123,456,789Prewarm selected store views:
php bin/magento lcp:prewarm --storecodes english,dutch,germanForce regeneration even when Redis entries already exist:
php bin/magento lcp:prewarm --products 123 --force trueThe module uses Magento's built-in message queue support.
Confirm the consumer exists:
php bin/magento queue:consumers:listStart the consumer:
php bin/magento queue:consumers:start elgentos_magento_lcp_product_prewarmFor production, run this consumer under a process supervisor or a dedicated container with restart handling.
Example env.php queue configuration:
'queue' => [
'amqp' => [
'host' => 'magento2_rabbitmq_1',
'port' => 5672,
'user' => 'guest',
'password' => 'guest',
'virtualhost' => '/'
],
],After installing or changing queue configuration, run:
php bin/magento setup:upgradeAfter installing or upgrading the module, test:
- configurable product page with a small option set;
- configurable product page with a very large option set;
- configurable product with swatches;
- configurable product without swatches;
- option selection and price updates;
- configurable add to cart validation;
- failed AJAX request path;
lcp:prewarmCLI command;- queue consumer after saving a parent configurable product;
- queue consumer after saving a child/simple product;
- customer-group cache behaviour if enabled.
Recent hardening in this fork:
- product option endpoint now returns a Magento raw result instead of using
echoandexit; - invalid product IDs return JSON error responses;
- AJAX failure handling has been added to the configurable and swatch mixins;
- queue consumer now launches the prewarm command using argument-array Symfony Process execution instead of a shell command string;
- Composer metadata has been updated for Magento 2.4 / PHP 8.
- Magento 2.4 / PHP 8 compatibility metadata update.
- Use Magento raw result response for product option JSON endpoint.
- Add AJAX failure handling for async configurable option loading.
- Use argument-array Symfony Process execution for prewarm consumer.
- Magento 2.4.6 compatibility update.
- Magento 2.3.5 / 2.4.0 compatibility.
- Throttle consumer process to avoid repeatedly prewarming the same product too often.
- Compatibility with Magento 2.3.x using built-in AMQP/RabbitMQ integration.
- Removed requirement for
renatocason/magento2-module-mq. - Updated
swatch-renderer-mixinupdateBaseImage. - Disabled configurable customer data mixin from RequireJS because the old auto-select behaviour was not working reliably in Magento 2.3.x.
- Added option to disable cache per customer group so group
0is always used.