I want to show a loading symbol on Add to Cart button when user clicks it. Currently in my site, when user clicks the button, it do nothing for 2-4 seconds and shows view cart button.
I want to show some loading or spinning icon during these 4 seconds. Is it possible? can someone guide me
I have a better solution, there is no need to append some image to the button.
WooCommerce provides a class ‘loading’. Simply append this class to Add to Cart button and that’s it.
And as soon as the product is added to cart you can use the removeClass function to remove the loader like
And for adding a WooCommerce Loader to a particular section you can use these WooCommerce functions
These two function block’s and unblocks a particular section by passing the specific id or class.
For the loading image on add to cart i might suggest to write a code in your js which loads on that page.
The link to image for loading is for example your can replace it with the one you want to.
Further more before apply the code in a file try to add it in from the browser console.