Magento: performance decreases as number of cart items increases

Magento: performance decreases as number of cart items increases

August 29, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento: performance decreases as number of cart items increases

Magento Performance Optimization for Large Carts

As an experienced developer working with Magento Enterprise 1.9, you’ve likely encountered performance degradation as the number of items in the cart increases. When dealing with 20+ or even 100 items, the site can become extremely slow and virtually unusable.

Understanding the Performance Issue

The core issue lies in Magento’s default architecture and how it handles cart data. With a large number of items, the system must process extensive queries and load substantial amounts of product-related data into memory for each page request.

This performance bottleneck is not limited to just the cart or checkout pages; it affects the entire site, as most Magento functionality relies on accessing cart information.

Optimizing Performance Globally

To mitigate this issue globally across all pages in your Magento store, consider these best practices:

1. Enable All Cached Levels

Ensure that all cache levels (including configuration, layout, block HTML output, and page output) are enabled to minimize database queries. You can do this by navigating to System > Cache Management.

// app/etc/local.xml
<cache>
    <cache_id_prefix>magento-</cache_id_prefix>
    <cachedir>/var/cache/</cachedir>
    <hash_lifetime>86400</hash_lifetime>
    <hash_tag_salt>.magento</hash_tag_salt>
    <use_redis>0</use_redis>
</cache>

2. Optimize Indexing

Regularly update your Magento indexes to ensure optimal performance.

php bin/magento indexer:reindex all

Optimizing Performance for Cart and Checkout Pages

For the cart and checkout pages specifically, where the impact is most noticeable:

1. Implement Asynchronous Loading

Use JavaScript to load heavy product data asynchronously after the initial page render. This technique reduces the time required to display the core content and improves perceived performance.

// Add this script to your theme's JavaScript file
require([
    'jquery',
    'mage/template',
    'Magento_Catalog/js/price-utils'
], function ($, mage) {
    $(document).ready(function () {
        $('.product-data').load('url-to-ajax-response', function () {
            // Reload product prices and other dynamic data after the AJAX response
            Magento_Catalog.priceUtils.init();
        });
    });
});

2. Limit Cart Item Count

Implement a limit on the number of items that can be added to the cart. While not addressing the technical issue directly, this prevents users from creating carts with an excessive number of items.

// Override Mage_Checkout_Model_Cart::addItem()
class Your_Module_Model_Cart extends Mage_Checkout_Model_Cart
{
    public function addItem($productInfo)
    {
        // Check if the cart item limit is reached and prevent the item from being added
        if ($this->getItemsCount() >= 100) {
            return false;
        }

        return parent::addItem($productInfo);
    }
}

Conclusion

Optimizing Magento performance for large carts requires a combination of server-side configuration, caching strategies, and client-side optimizations. By following these best practices and tailoring them to your specific environment, you can significantly improve the site’s responsiveness when dealing with a high number of items in the cart.

Remember that Magento is a complex system, and performance tuning often involves a systematic approach addressing multiple aspects simultaneously. Regular monitoring, benchmarking, and iterative improvements are essential for maintaining optimal performance as your store grows.

For more advanced Magento optimization techniques and best practices tailored to your specific needs, consider consulting with our expert team at Laravel Company.

Magento 1 Checkout Catalog Cache

Our network