Skip to content
 
 

Repository files navigation

Elgentos_LargeConfigProducts

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.

Compatibility

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.

What It Solves

  • 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.

Frontend Behaviour

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.

Redis Cache Keys

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.

Configuration

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

Console Prewarm

Prewarm all configurable products:

php bin/magento lcp:prewarm

Prewarm selected product IDs:

php bin/magento lcp:prewarm --products 123,456,789

Prewarm selected store views:

php bin/magento lcp:prewarm --storecodes english,dutch,german

Force regeneration even when Redis entries already exist:

php bin/magento lcp:prewarm --products 123 --force true

Queue Consumer

The module uses Magento's built-in message queue support.

Confirm the consumer exists:

php bin/magento queue:consumers:list

Start the consumer:

php bin/magento queue:consumers:start elgentos_magento_lcp_product_prewarm

For production, run this consumer under a process supervisor or a dedicated container with restart handling.

RabbitMQ Configuration

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:upgrade

Validation Checklist

After 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:prewarm CLI command;
  • queue consumer after saving a parent configurable product;
  • queue consumer after saving a child/simple product;
  • customer-group cache behaviour if enabled.

Upgrade Notes

Recent hardening in this fork:

  • product option endpoint now returns a Magento raw result instead of using echo and exit;
  • 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.

Changelog

0.4.2 - 2026-07

  • 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.

0.4.1 - 2023-03

  • Magento 2.4.6 compatibility update.

0.3.6

  • Magento 2.3.5 / 2.4.0 compatibility.

0.3.5

  • Throttle consumer process to avoid repeatedly prewarming the same product too often.

0.3.4

  • Compatibility with Magento 2.3.x using built-in AMQP/RabbitMQ integration.
  • Removed requirement for renatocason/magento2-module-mq.
  • Updated swatch-renderer-mixin updateBaseImage.
  • 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 0 is always used.

About

Large Configurable Products workaround for Magento 2

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages