Magento Checkout Slow? Fix it in 8 Simple Steps

Magento Checkout Slow? Fix it in 8 Simple Steps

Magento Checkout Slow? Fix it in 8 Simple Steps

It’s common to see Magento Checkout pages that loading 2x-5x more JavaScript code than any other page of the store. Combined with the fact that Checkout doesn’t benefit from cache, a visually simple Checkout page can spend up to 20 seconds downloading, executing, and rendering hundreds of JS scripts and API requests.

large_code_size magento checkout slow

Slow Magento Checkout affects your conversion rate, lowers customer satisfaction, and directly correlates with fewer sales. That’s why it’s so important to make it fast, reliable, and easy to use.

Today we’ll focus exclusively on the speed. We’ll explain to you the most common Checkout challenges and offer effective solutions and tools to make the checkout process as fast as possible.

Understanding Magento Checkout Loading Issues

magento checkout slow ckeckout_busy

We’ve already shown how to speed up regular Magento 2 pages and Magento 2 Admin Paneloptimize your Add to Cart speed, and boost Magento database performance. It’s time to focus on slow Magento Checkout.

Magento Checkout page works differently than other pages. It almost exclusively loads based on Knockout.js. JavaScript renders the whole page except for a few select sections. Only such data as payment and shipping methods, total sums, along with separate save data requests are loaded using separate tools. No other page has this much JavaScript code.

Checkout is one of the most complex and heavy pages of your store. No surprise then that it can be the slowest as well. Despite all the above tips, the top tip from us would be to check your hosting provider for performance.

Install a clean Magento store with sample data and fixtures for performance testing and see if your Checkout speed is good – if it’s fast, then the bottleneck is in the code, nothing is wrong with your hosting. If your Checkout is very slow even on the demo store, you need to find a better hoster. Preferably someone with a strong, Magento-focused tech support team. The kind of team that offers help on every aspect of your store.

How Much Is Too Much?

If your Magento Checkout gradually became slower over time as your store grew, the underlying issues can be with garbage collection, database junk, Magento system file housekeeping challenges, and other clutter-related issues.

Review extensions as they are among the most obvious trouble makers. Individually they all might be fine. But if you use dozens of feature-rich extensions at the same time, performance will suffer. This is inevitable. After all, extension developers test their products on a clean Magento install and can’t predict what kind of performance hit to expect from dozens of customizations working simultaneously on a single Checkout page.

8 Fixes for Slow Magento Checkout

During the initial load, Magento Checkout can be slow for a number of reasons. We’ll go through all of them one by one.

1. Unoptimized Static Content

Challenge: Of all Magento pages, Checkout hosts the biggest number of static resources, mainly JS scripts. On Checkout, even a brand new Magento 2 store will load 270+ JS files totaling 2.8 MB which is a huge amount of data. Add to that more JS scripts from third-party extensions and you have on your hands a beast of a page with hundreds of JS files.

magento checkout slow number_of_files

Solution: Apply manually done Advanced JavaScript Bundling alongside a good Content Delivery Network to serve static resources faster (don’t use Magento JS Bundling option, it’s poorly built).

Magento’s built-in JS bundling can negatively influence page performance. It doesn’t offer adequate gathering of all JavaScript files in a single batch means the browser needs to download it first before moving on to the execution phase.

How to apply advanced JS bundling:

  1. You’ll need node.js, npm, and require.js
  2. Install Magento 2 DevTools from this link as a Chrome extension
  3. Go to Magento store, then find the Record button in the extension
  4. Start recording, then visit all the pages you want JS Bundle to work on (and most importantly Checkout, Home, Catalog, Product View, Shopping Cart)
  5. Get the brand new build.js file and put it into Magento root directory
  6. Switch to Production mode and turn off built-in JS Bundling and JS Merging in Magento Admin Panel
  7. Generate static content (php bin/magento setup:static-content:deploy)
  8. All static content will be located at /pub/static/frontend/Magento/luma/en_US/ where luma is the name of your theme and en_US is the locale of your store.
  9. Rename the locale folder from en_US to en_US_source
  10. Execute from Magento root directory: r.js -o build.js optimize=uglify2 baseUrl=”pub/static/frontend/Magento/luma/en_US_source/” dir=”pub/static/frontend/Magento/luma/en_US/” 
  11. If you caught an exception while running the command from Step 10, make sure you have no extra symbols in the config in package names
  12. Reload the Magento store page to measure the speed boost

magento checkout slow record_require_js

2. Complex Network Code

Challenge: JavaScript code contributes significantly to slow page loads. Unfortunately, apart from refactoring or disabling the code, there’s not much you can do to quickly fix this issue. 

Performance issues might not stem from one specific third-party extension. The problem becomes apparent when you overload your Checkout page with too many extensions and integrations. Small delays that happen from a single extension execution pile up to create a barely usable Checkout page.

Solution: Turn off as many integrations and extensions as you can. No need to have all these features if they lower page usability instead of improving it.

js-optimization-magento-2 for slow checkout

Use your browser’s JS profiler to find other slow Magento code pieces and deal with them.

3. Too Many Price Rules

Challenge: Magento calculates store prices upon entering the Shopping Cart. On Checkout, the cart is calculated and re-calculated multiple times, too. One-step Checkout performance suffers from store price rules in the same manner as the Shopping Cart.

catalog_price_rules magento checkout slow

Solution: Over time, a fairly large and active store will accumulate dozens of unused active price rules. Magento has to check every single active price rule before it can calculate the correct price for the item. Reducing the number of active rules improves performance both on Checkout and inside the Shopping Cart.

Switch off store price rules you don’t use at the moment. Go to Marketing > Promotions > Cart Price Rules. Select all the rules you don’t use right now and make them inactive. This is enough to stop Magento 2 from using them during Checkout price calculations.

Now go to Marketing > Promotions > Catalog Price Rules and do the same there: disable all rules you no longer use. Note that rules that have expired to/from date or are already inactive don’t slow down Magento in any way.

4. Complex Checkout

Challenge: For Magento store owners, it has become standard practice to switch to onepage Checkout (aka one-step checkout). In addition to obvious improvements in user experience, single-page layout reduces page load time thanks to built-in optimizations already present in most single-page extensions.

Solution: Implement onepage checkout to speed up page load. Here’s a quick suggestion with lots of customizations but feel free to do your own research and find the extension that suits you best.

one_step_checkout to speed up magento

5. Unused Active Shipping Methods

Challenge: To shut off another part of the store that slows down Checkout performance, switch off unused shipping methods and carriers. The problem with shipping carriers is that Magento has to wait for shipping API data before it can fully render the page.

Worst offenders: UPSP, UPS, FedEx, Multishipping (Temando Shipping), and DHL where Magento has to wait a long time before the carriers return shipping rates. The chain from the initial request to the end result is really long. First, the customer enters Checkout, changes their shipping address. During each change of the ZIP code or country, Magento sends requests to the shipping carrier server asking which shipping methods and rates apply for the current setup.

After the successful answer, Magento applies new changes to the Checkout page. This is the time when the loading spinner disappears from the user interface.

Depending on your site configuration and the distance between carrier servers and your own server location, the delay from these 4 carriers can range from 2 to 3 seconds.

Solution: You can easily reduce the wait time if you go to Stores > Configuration > Sales > Shipping Methods and select only the carriers you really need.

6. Unused Active Countries

Challenge: If you don’t specify active countries, Magento has to work harder to fetch them all which slows down Checkout performance.

Solution: If you don’t ship to certain regions, don’t accept orders from such customers. It’s a good idea from both the business perspective and for your Checkout performance to exclusively ship to countries you want to work with.

shipping_allowed_countries

There are two separate options that manage shipments to different countries. Ship to applicable countries and Ship to specific countries have independent shipping methods. That’s why you need to customize the list of applicable countries for every shipping method separately. For example, you can setup FedEx to ship exclusively to the US. At the same time, you can use UPS to ship to Europe and the US and use DHL for Asia only.

This kind of separation is important to limit the amount of server back-and-forth. Without a properly set up internal Magento country limitations, Magento will send API requests to all 3 shipping carriers, wait for the response of the first two that are not applicable (and waste our time), then find the third and only shipping method that actually works for this country and return the result.

So instead of customizing shipping limitations only inside specific carrier accounts, specify them inside Magento, too.

The best solution here is to switch off unused countries directly from Stores > Configuration > General > General > Country Options. This way you make sure that inactive countries never get processed or included in the server’s response. As a result, the Checkout page becomes lighter and easier to handle.

7. Unused Payment Methods

Challenge: This fix is based on the same issue that you have already seen in tips 5 and 6. Unused payment methods generate unnecessary load on your server. Each request creates a small delay and adds up to the overall sluggish performance of your Checkout.

Offering your customers more payment options is a great feature. But instead of blindly turning on every possible way your customer can complete their purchase, review how often each payment method is really used. There are bound to be a lot of outsiders with a minuscule amount of use. Disable those payment methods. They generate more lag than profit.

cash_on_delivery_payment_method unused payment method to speed up checkout

Solution: Not all payment methods are as easy to remove from Checkout as Cash On Delivery. Some of them like PayPal are closely integrated into Magento and need more powerful tools to deal with.

There are 2 main ways to disable payment methods. First, by disabling certain modules such as Magento_Authorizenet directly in the code (overwrite default Magento behavior instead of changing Magento Core!). Alternatively, you can use an extension that does this for you.

Modules you can safely turn off:

8. Unoptimized Configurable Swatches Observer (Magento 1.9 Only)

This fix is specific for Magento 1.9 slow Checkout issues. Find the function loadChildProductImagesOnMediaLoad in Observer.php located at app/code/core/Mage/ConfigurableSwatches/Model/ and rewrite the public function as follows:


Note that the change will be noticeable for Checkout pages with configurable products. Other types of products are not affected. The optimization will shave off 50 ms from each configurable product on Checkout.

Summing Up

Some fixes we’ve listed here overlap between Magento Cart and Magento Checkout so make sure you read our Magento Add to Cart optimization guide and implement those fixes, too.

Remember that Magento Checkout is a complex system with lots of elements. Even after implementing all our advice you can still experience performance issues. Use Magento Profiler or other powerful tools (MGT Developer Toolbar, Aoe Profiler, New Relic, etc.) to thoroughly examine all events that slow down Checkout performance.

See if your issues persist when you switch off additional features – keep your server stack as simple as possible during profiling to eliminate complicating the debug process with additional factors.

Checkout pages are extremely diverse. They will experience different challenges based on active extensions, customizations, and scripts that need careful examination from an experienced development team.

Let’s get in touch to see how our expertise can help you make Magento Checkout as fast as any other page of your store.

Magento tips from real projects
Magento tips from real projects
Close
CALL US 24/7:
Australia
& asia
+61 (02) 8005-7494