Reading list Switch to dark mode

    How to run custom JS after ajax call to custom/section/load

    Updated 29 February 2024

    In this blog I’ll explain how to event listener for ajax call to custom/section/load. Magento sends ajax request to custom/section/load every time it loads data or perform any action with ajax request. Some examples would be Add to Cart, Update Cart Item quantity, on Checkout page, etc.

    After successful call to custom/section/load, Magento trigger custom event “customer-data-reload”. So we can listen to this event with below code.

    $(document).on('customer-data-reload',function(e, arg){
        console.log(arg);
    });

    The arg is an array which consists the sections that were updated. Some examples would be message, cart, customer, compare-products, last-ordered-items, wishlist, recently_viewed_product, checkout-fields, etc.

    Feel free to comment if you have any query. 🙂

    Searching for an experienced
    Magento 2 Company ?
    Find out More
    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home