How to optimize Magento 2.4.6 checkout performance with large catalogs?
Asked 1/15/2024
1240 views
I'm experiencing slow checkout times with a catalog of 50,000+ products. The cart page takes 8-12 seconds to load. I've already enabled full page cache and Varnish, but still seeing issues with:
## Current Setup
- Magento 2.4.6 Commerce
- MySQL 8.0
- Redis for session and cache
- Varnish 7.0
- PHP 8.1 with OPcache
## Performance Issues
1. Cart page load time: 8-12 seconds
2. Checkout step transitions: 3-5 seconds each
3. Order placement: 15+ seconds
## What I've Tried
- Enabled all Magento caches
- Configured Redis properly
- Optimized MySQL queries
- Set up Varnish with ESI
The issue seems to be related to quote calculations and tax/shipping estimation. Any suggestions for further optimization?
Magento 2.4
Performance
Checkout
SC
Sarah Chen
Senior Magento Developer
15420 reputation
Comments
MR
Are you using any custom checkout extensions? They could be causing the slowdown.
Mike Rodriguez • 15-01-2024
1 Answer
31
Accepted Answer
The performance issues you're experiencing are common with large catalogs. Here's a systematic approach to optimize your checkout:
## 1. Quote Performance Optimization
### Disable Unnecessary Quote Collections
```xml
<!-- app/code/YourModule/etc/di.xml -->
<config>
<type name="Magento\Quote\Model\Quote\Item\Repository">
<arguments>
<argument name="itemProcessor" xsi:type="object">CustomQuoteItemProcessor</argument>
</arguments>
</type>
</config>
```
### Optimize Tax Calculation
- Enable "Use Customer Group Tax Class" in **Stores > Configuration > Tax**
- Set "Catalog Prices" to "Including Tax" if possible
- Use flat tax rates instead of complex tax rules
## 2. Database Optimizations
### Add Missing Indexes
```sql
ALTER TABLE quote_item ADD INDEX idx_quote_item_quote_id_product_id (quote_id, product_id);
ALTER TABLE catalog_product_entity ADD INDEX idx_catalog_product_sku (sku);
```
## 3. Checkout-Specific Caching
Enable checkout session caching in Redis:
```xml
<config>
<cache>
<frontend>
<id_prefix>checkout_</id_prefix>
<cache_lifetime>3600</cache_lifetime>
</frontend>
</cache>
</config>
```
This should reduce your checkout times significantly. Let me know your results!
AT
Alex Thompson
Magento Architect
22100 reputation
Answered 15-01-2024
SC
This is exactly what I needed! The tax calculation optimization alone improved performance by 40%.
Sarah Chen • 15-01-2024
MR
Great answer! Don't forget to also check for custom observers that might be slowing down quote saves.