'Prestashop 1.7.4.2 - add to cart ajax very slow (TTFB 3 seconds)

I have a problem with add to cart button. After I pressed, I need wait 4 - 6 seconds. If you open console, you will see 3 calls with 2 - 3 seconds every. The wesite is: https://wowpet.ro .

I tried:

  1. Disabled all modules. - (themes modules, core modules)
  2. Disabled override.
  3. Clear cache/ changed settings for cache (minify js, css etc).
  4. Activated debug - (nothing happened)
  5. Checked err_log file (nothing wrong)
  6. I moved the shop in another host (same time)
  7. Enabled/disabled ajax cart from module.
  8. Updated at 1.7.6.7 but I got an error 500 in homepage. (I restored 1.7.4.2).

Can you help me with a suggestion?

Thank you!!



Solution 1:[1]

There was an issue in one of the PrestaShop version, where due too high timeout set inside core javascript files, we could see slow processing of this request. I suggest to work on an update to newer version, of course you'll need to do that on some dev version, not directly on a production site.

Solution 2:[2]

During AJAX add to cart many checks are performed on DB, so make sure to check and keep DB ps_cart_rule table as clean as possible, especially if you have many "automatic rules" without coupon code and/or not binded to specific conditions (id_customer etc.) or you are using third party module to massively generate cart rules.

Always perform regular manteinance by deleting expired / inactive cart rules from time to time and you'll see major improvements in TTFB when adding products to cart.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Krystian Podemski
Solution 2 user3256843