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. 🙂
Be the first to comment.