Skip to main content

Slow add-to-cart and quantity updates in FluentCart 2.2.0

Hi everyone,

We’re experiencing slow cart updates on a WordPress site using FluentCart and FluentCart Pro 2.2.0, Bricks, LiteSpeed and PHP 8.4.

A test against the native FluentCart cart-update endpoint recorded:

  • Add one product: 7.79 seconds
  • Change quantity to two: 2.92 seconds
  • Remove the product: 3.43 seconds

These measurements bypassed our custom frontend JavaScript, but still included network time and all active server-side plugins and hooks. We use a custom FC Ecom Suite plugin, so we haven’t established whether the delay originates in FluentCart, our integration or hosting.

While reviewing FluentCartApp.js, we also noticed that the Add button retains its loading state for an additional 300 ms after a successful cart update. The native mutation XHR appears to have no configured timeout.

Could the team advise on:

  1. Expected cart-update response times and recommended profiling steps.
  2. Hooks or integrations that commonly delay cart mutations.
  3. Whether the extra 300 ms loading delay is intentional.
  4. How stalled or interrupted cart requests should recover safely without duplicating additions.

We can provide sanitized request timings and responses. We have not modified FluentCart’s files.

Thank you.

Shahjahan Jewel

Not sure what happened to your case but it should not take more than a second. I will take a look. In the meantime, would you please open a support ticket so our engineers can follow up with you on Monday.

Shahjahan Jewel

From the primary observation:

Expected times and how to profile. On a typical store a cart update should take well under a second, so 3–8 seconds is not normal. Every cart-update response already includes a _bench field. It shows how many seconds FluentCart itself spent on the request.

  • If _bench is small and the total time is large, the delay happens before FluentCart runs. Likely causes are WordPress loading other plugins, the theme, admin_init hooks, or the hosting.
  • If _bench is large, the time is spent in the cart logic or in hooks attached to it.

Please send us the _bench value for each of your three requests. Please also repeat the test once with FC Ecom Suite turned off. A Query Monitor capture of one slow request would also help.

Hooks that commonly slow cart changes. Every add, update or remove fires these hooks:

  • fluent_cart/cart/item_added or fluent_cart/cart/item_removed
  • fluent_cart/cart/cart_data_items_updated (shipping and tax are recalculated here)
  • fluent_cart/checkout/cart_amount_updated
  • fluent_cart/checkout/cart_updated
  • fluent_cart/cart/item_modify

Slow code on any of these hooks makes every cart change slower, especially code that calls an external API or runs heavy queries.

The 300 ms delay. Yes, it is intentional. The cart is already updated at that point, so the delay is visual only. It also stops a quick double-click from adding the item twice. It does not affect the timings you measured.

Safe recovery from stalled requests. You are right that the cart-update request has no timeout. We will look at adding one. For your integration:

  • An "add" request increases the quantity by the amount you send. If you retry an add after a lost response, the item can be added twice.
  • To recover safely, first fetch the current cart with fc_checkout_action=fluent_cart_cart_status, then decide whether to send the add again.
  • Alternatively, send by_input=true with the full quantity you want. That sets the quantity instead of adding to it, so you can repeat it safely.

Once we have the _bench values, we can tell you where the time goes.

S B

Thank you, will continue to investigate on my end. perhaps it's just me.

S B

Just a quick update, i found the issue, my plugin was constantly pulling shipping rates upon adding removing items when the user was logged in. Sorry for the inconvenience.