Magento 2 Add to Cart Is Slow. How to Fix It? (Updated for 2024)

Boosting Magento Add to Cart

Magento is among the most versatile and flexible eCommerce platforms. But it may not always be among the most rapid ones. Even if you’ve created an efficient store at the beginning, introducing more sections and products as the business grows may increase memory consumption and the load on the server. As a result, the loading speed drops.

Yet, it plays an important role in converting website traffic into paying customers. Whether you have an extensive product catalog or diverse payment options, prospects still expect the store to load fast. In fact, in one moment.

This rule applies not only to your product pages or . Once consumers click the “Add to Cart” button, the response from the server should also come in the blink of an eye. If not, a shopper may try to hit the button several times, adding more items to the cart than needed. That isn’t very pleasant, at the very least. And let’s not forget that cart and checkout speed contribute to customer satisfaction and lower abandonment rates.

In this helpful guide, we’ll discuss some of the problems online merchants face with the Add to Cart action and how to speed up Magento.

Magento Performance: Key Considerations and Peculiarities

Over the years, the community managed to successfully combat the majority of Magento speed issues using a variety of tools. Most of the problems boil down to cache management, profiling, and manual bottleneck fixes.

When it comes to a store's speed issues, lots of developers are tempted to turn to caching to mitigate sudden performance drops. It's a common misconception even among developers, but cache almost never equals load speed. It's a great tool for dealing with other Magento inefficiencies, such as cache swelling and file fetching. But cache doesn’t make your whole store faster.

It's only used to facilitate website content delivery. And, of course, Magento doesn't cache the Shopping Cart (for obvious reasons). Magento 2 Add to Cart logic and Cart View itself both need to stay dynamic throughout the whole user experience.

 Magento 2 Add to Cart

Users need the ability to add or remove products from the cart at any time during shopping, apply promo codes, change the delivery or payment method, or in any other way, change your store content.

Magento 2 Add to Cart

Slow Magento Add to Cart: What Can Go Wrong

Both Magento 1.x and Magento 2.x Add to Cart can be slow. Even though the platform doesn’t cache Cart contents or Add to Cart, the uncached content should still load in less than 1 second. 

Why is your Magento Add to Cart very slow? To find out the real cause of the problem, you'll need to manually examine two possible bottlenecks: hosting and code. If you struggle with a lack of expertise, our will help.

Here is a list of the top reasons why something can go south:

  • template inefficiencies;
  • issues with third-party extensions;
  • nonoptimal server configuration;
  • inadequate resource allocation;
  • unnecessary overheads.

Without a good tool to explore which call or function creates too much stress on the system, you won't understand what you need to fix in the first place. We've already shown you and . So, to learn what makes Magento 2.x and Magento 1.9 Add to Cart very slow, read on.

40 Hours of Magento Services. FOR FREE

Try our custom development, optimization, support, and design services. One week, free of charge, no strings attached.

9 Tips on What to Do if Your Magento 2 Add to Cart Is Slow

Is your Magento Add to Cart slow? How can you speed up Magento 2 Add to Cart? In this article, we'll share nine recommendations to guide you through the process of making the Add to Cart faster on Magento.

1. Determine Which Part of the Store Creates the Bottleneck

In order to find the true bottleneck, you'll need to test the performance of different areas of the eCommerce website, from the homepage to checkout. Sometimes, solutions for a better user experience may actually harm the UX. For example, implementing a Magento Persistent Shopping Cart functionality can add extra load times to the add-to-cart process. This happens because the system must check and update the cart data each time the user adds an item. By learning more about your underperforming parts, you’ll be able to create a detailed plan on where to direct your efforts. As a result, you’ll speed up Magento and, as a bonus, get the best score as well as improve your

As you try to optimize slow Magento 2 Add to Cart and the overall Magento website speed, bear in mind the following thing. Web hosting infrastructure will determine the baseline of your store speed. Hardware plays a key role in creating the foundation of what you can expect from the Magento 2 store.

How can you tell if your real store suffers from underpowered hardware? Install default Magento with sample data and measure how well it performs. If the sample store runs poorly, then this is your bottleneck. Right here.

If you suspect that sample data doesn't reflect the current load on your store, generate more categories and products . Create as many new product pages and categories as you need to come as close as possible to the real-life setup of your store.

Lima's Product page

Depending on your exact needs, there are two solutions you can implement in Magento to speed up Add to Cart:

  • upgrade to a better hosting plan (choose Magento-optimized servers if you can),
  • fix your server configuration if the hardware is powerful enough already.

If you see that the demo Magento store runs well, then the issue is with the code. Depending on the reason, we'll need to fix the underlying issue. Start with profiling the Cart with the default Magento Profiler or run any profiler of your choice. Once you find the bottleneck, you'll need to deal with it. Here's a handy to get you started with the Profiler.

If you want to use something more capable, take a look at . It's a great alternative to the default tool and 100% worth a quick look.

Profiling works well if the bottleneck is in a database table, third-party extension, a few rogue scripts, or pieces of content. Working with the load table, you can sort the results by time to see which items have the biggest values in the fields Time and Cnt.

If you see that the store works fine and the problem is inside one of the extensions, switch them off on the test setup and then turn them on one by one to find those that slow your Magento 2 Cart the most. Profiling works best for this type of analysis, where you can rule out one item at a time and then move on to the next.

Here we've listed a few tips on how to make the shopping cart lighter without sacrificing too much. 

2. Speed Up Inventory Management

To understand why the Add to Cart button can be very slow, you need to know what happens when the user clicks this button. Adding to Cart means Magento first has to check if the item is still available. This check is important to resolve possible conflicts when two or more users want to buy the same product with limited inventory.

The check happens within the Inventory Management section of the store, where Magento looks up item availability from a specific database table and then changes its value according to the user's actions in the store.

Okay, since now we understand the mechanism of the delay, we can do something about it. Two ways:

  • speed up the database to shorten inventory lookup time,
  • disable inventory management to boost Add to Cart performance (not a good idea unless your business sells thousands of identical items).

3. Disable the Carriers You Don't Use

Fetching carrier rates takes time. With the exception of Flat Rate and Free Shipping methods, the system needs to send a request to the carrier's server and fetch the response. The whole thing can take anything from 200 to 700 ms. The wait time quickly adds up to whole seconds your customers have to wait before they can act.

Removing the carriers you don't use is easy and can possibly shave off 1-2 seconds of the loading time without writing a single line of code. Go to Stores > Configuration > Sales > Delivery Methods and remove carriers you don’t work with.

4. Remove Estimated Shipping to Simplify Your Shopping Cart Page

Estimated Shipping is a good UX tool that helps you set customer expectations about pricing. Even so, if the shopping cart is too slow, you can push this information one step further – toward the checkout. This move will lift some burden off the server if your cart is overloaded with functionality and you can't balance it right.

for Magento 2 tell us that in order to customize the Checkout steps, you have to change checkout_index_index.xml (do it through custom module override, don't change Magento Core directly). In our case, we want to get rid of a specific Knockout component inside the cart shipping block.

According to DevDocs, you can disable Knockout components by passing the componentDisabled option into their config section using layout instructions. It looks like this:

<item name="%the_component_to_be_disabled%" xsi:type="array">

   <item name="config" xsi:type="array">

       <item name="componentDisabled" xsi:type="boolean">true</item>

   </item>

</item>

For our needs, the instructions will be as follows:

<referenceBlock name="checkout.cart.shipping">

   <arguments>

       <argument name="jsLayout" xsi:type="array">

           <item name="components" xsi:type="array">

               <item name="block-summary" xsi:type="array">


                   <!-- My custom part: -->

                   <item name="config" xsi:type="array">

                       <item name="componentDisabled" xsi:type="boolean">true</item>

                   </item>


               </item>

           </item>

       </argument>

   </arguments>

</referenceBlock>

In addition to checkout_index_index.xml, you need to remove or comment on the following lines located in checkout/cart/shipping.phtml. Since it's a bad idea to directly change Magento internals, you need to override this template file in your custom module/theme and remove the lines there. Without this step, you'll still see the header of a now obsolete block:

<div class="title" data-role="title">

   <strong id="block-shipping-heading" role="heading" aria-level="2">

       <?php /* @escapeNotVerified */ echo $block->getQuote()->isVirtual() ? __('Estimate Tax') : __('Estimate Shipping and Tax') ?>

   </strong>

</div>

All done? Good job. One less thing to worry about.

5. Disable Unused Shopping Cart Rules

It sounds obvious, but this tip offers a noticeable performance improvement. Apparently, Magento constantly checks for cart price rules before showing you the final amount. Naturally, a busy online store will have dozens of unused rules, which slow down Magento 2 cart and checkout speed.

Shopping Cart Rules

Cleaning up all unused active rules offers a nice performance boost to both the Cart and Checkout. Just disable them, and you are done here. Make sure you flush the Magento cache to see the improvements.

6. Truncate Magento Database to Run Faster

Upgrading to a can massively help you out, but if you've done everything else here and still don't see improvement, look closely at your database. Over time, reading these massive databases and adding new entries becomes slower and slower. One of the solutions is to back up and truncate the tables. This solution works best for larger stores with millions of entries that don't hold a lot of value anymore.

Truncate and optimize the following database tables: 

  • dataflow_batch_export,
  • dataflow_batch_import,
  • log_customer,
  • log_quote,
  • log_summary,
  • log_summary_type,
  • log_url,
  • log_url_info,
  • log_visitor,
  • log_visitor_info,
  • log_visitor_online,
  • report_viewed_product_index,
  • report_compared_product_index,
  • report_event,
  • index_event,
  • Catalog_compare_item.

7. Optimize or Disable Extensions to Speed Up Magento Cart

Magento extensions that affect Add to Cart functionality, Magento shopping cart price rules, catalog rules, or add custom product options can severely slow down your Magento 2 Cart.

There are two approaches you can take here. The hard approach is to optimize the custom Magento extension that interferes with the Cart performance. Reviewing and refactoring code you have never seen before is not a trivial task, even for an experienced developer.

If you have the option, just turn off the unnecessary extension and look for alternatives that don't affect your cart performance as much. After all, this extension can't be the only one in the market.

8. Disable Minimum Advertised Price in Advanced Sales

Getting rid of complex cart price rules you don't use inside the store will help alleviate some pressure off the Shopping Cart. When the system doesn't need to check for an additional value in the database, this time can be spent on the actually important stuff.

One of these values people rarely use is MAP (Minimum Advertised Price). It's a vital feature for some stores that can't legally advertise a price lower than a price recommended by the manufacturer (commonly known as MSRP).

Anyway, most stores don't need this feature, and you can safely turn it off at Stores > Configuration > Sales > Sales.

Advanced Sales

9. Review All Add to Cart Events That Slow You Down

Let's return to the topic of profiling once again. You need to carefully examine what happens when the user clicks Add to Cart. Some slow-downs are easier to catch using New Relic, Blackfire, and similar performance monitoring applications than Magento Profiler.

For example, in one of our cases, a third-party analytics module sent curl requests upon adding new products to the Shopping Cart. As you might expect, this additional heavyweight cart event made the Magento 2 Add to Cart slow for the users.

Shopping Cart Customization: Add Extra Features Smartly

Optimizing the shopping cart to the fullest doesn’t rule out the possibility of customization. Some may be skeptical about adding new features, thinking it will slow down loading times and complicate the user experience. However, with careful implementation and well-structured design, it’s possible to introduce extra functionality without sacrificing performance.

Have you ever considered using a shopping cart for upsells? Onilab’s long-term client Bright Star Kids adopted this strategy to motivate its customers to buy more items in one go. The brand specializes in customized gifts and products for children and adults alike. Its top feature is a product builder, allowing users to craft orders with unique designs.

This was by far not the only enhancement for the . Find more information in our portfolio.

Summing Up Magento Add-to-Cart Issues

While you are investigating your Cart performance, bear in mind that a slow Magento Add to Cart functionality can have multiple origins. Even if your cart is working smoothly, remember to set up a flow to reduce shopping cart abandonment and capture as many of those conversions as possible.

We’ve listed the 9 most general solutions we use to deal with Magento 2 Cart daily, whether you have slow Magento 1.9 Add to Cart or the same issue on newer Magento 2. We hope these tips will improve your operations and result in more sales. Even though these pieces of advice are quite effective, profiling Magento code for performance is the best way to find out bottlenecks and other speed issues, which will differ from site to site.

Implemented all our recommendations and still can't reach that <1-second performance mark on Magento 2 Add to Cart? Feel free to contact us for , and let's discuss how you can achieve better Cart performance with a talented team of professional eCommerce web developers.

Magento 2 Add to Cart: FAQ

Why Is My Magento 2 Add to Cart Slow?

A Magento store can have a slow loading time when users add products to the shopping cart due to various reasons, including:

  • improper server configuration;
  • conflicting or excessive third-party extensions;
  • poor database optimization;
  • too many cart events creating a slow-down effect;
  • neglecting inventory management;
  • fetching too many carriers;
  • using estimated shipping at the shopping cart rather than checkout;
  • having a Minimum Advertised Price switched on;
  • burdening the cart with redundant price rules.

To find the real problem with the Magento 2 shopping cart, install a default store with a lot of pages and content. It should resemble your real-life store as much as possible. This step will help you define whether it's the code or web hosting that requires your attention. After that, you may either check the server requirements, change a hosting provider, or employ a profiler to analyze website performance.

How Do I Fix Slow Magento 2 Add To Cart?

To speed up the Magento Cart, you may try these steps:

  • Check your metrics, such as server response times, database query performance, etc.
  • Optimize your database and inventory management.
  • Delete the unused carriers and extensions.
  • Deactivate unnecessary or complex cart price rules and the estimated shipping capability.

These actions regard specific Magento 2 Add to Cart cases. General tips for maintaining your eCommerce website's speed high may also deal with CSS settings, caching, image optimization (prioritizing more advanced solutions over a JPEG format, for example), and others.

What Are the Common Tips for Boosting Magento Performance?

Among the various ways to speed up the Magento Cart, we can mention the following essential steps:

  • Updating your Magento to the latest version (the new releases will provide better performance optimization, will be free from bugs that took place in previous versions, and bring in new enhanced features);
  • Removing unused extensions (tons of solutions may send too many requests to the server, as they work independently. Plus, they can be poorly coded or conflict with one another, contributing to slower page loading);
  • Installing a lightweight theme (such a solution may require fewer resources, have simpler code, and minimize the usage of JavaScript & CSS);
  • Optimizing product images (favor the SVG format as it provides a better image quality with a lower file size);
  • Working with the code (make sure you don't enable JavaScript bundling to avoid sending heavy JavaScript files to the server);
  • Switching to a content delivery network (CDN) (this move helps you deliver content from the nearest server to users, reducing the needed time to load the page);
  • Leveraging cache (you can use an in-built cache or enable Varnish cache as a more flexible solution which reduces loading time for previously viewed pages).

Let’s stay in touch

Subscribe to our newsletter to receive the latest news and updates.