eCom limit for Ajax Calls?

TradingboTradingbo Member Posts: 36
edited May 2020 in Theme and Design

Hi Support,

We've adapted the following Ajax snippet to add products to customer Wishlists:

$('.static-product-wrap, .productpage').on('click', '.wishlist[data-wishlist]', function(e)
    // if logged in
    if( ) {
    var button = $(this);
    button.html('<i class="fas fa-spinner fa-spin"></i>');
      url: $(this).attr('href'),
      if( isIE() && ! )
        return true;
       button.html('<i class="heart-icon"></i>');
      $('.tb-wishlist').html( $(data).find('.tb-wishlist').html() );
      $('.header-heart.wishlist').html( $(data).find('.header-heart.wishlist').html() )

It reads in your documentation that making multiple Ajax calls in a short period could see users banned from shops?

This snippet is based off user input, sending ajax href="account/wishlistAdd/" requests when clicked.

Would this be acceptable use of Ajax in this context? and if no, why not?

Best wishes,


  • MilesbdMilesbd Moderator, Lightspeed Staff Posts: 25 moderator

    Hi @Tradingbo !

    Triggering an AJAX request based off of user input/action is one of the preferred methods of usage, as it deferred the AJAX request until needed. In this scenario, it is unlikely that any user through navigation (i.e. clicking) would be able to exceed the limits of front-end AJAX requests.

    The documentation referencing multiple AJAX requests in a short period is in the context of the front-end api limit (i.e. the data that is retrievable via AJAX), as there are safeguards to avoid too many requests. This limit lies in the multiple requests per second region.

    Happy coding!

  • TradingboTradingbo Member Posts: 36

    Hi Miles,

    Brilliant, thanks for confirming!

Sign In or Register to comment.