Is it possible to make add to cart button work offline?
Is it possible to make add to cart button work offline?
Please see the video for clear idea.
https://youtu.be/7Ie2vE6FXfE
Closed
May 11, 2026
Hello @Kazi,
You may check default WooCommerce theme - Storefront -> https://themes.woocommerce.com/storefront/shop/ which will show you very similar results (I tester it and it was almost same).
Adding to cart requires connection to php function that is working via ajax. In simple words adding to cart on servers (not localhosts) works in next way:
1/ Click on add to cart button
2/ In js scripts is started a call to the php function that is chained to that js action. (This step requires connection to server which is only with internet connection)
3/ Once that function was loaded - there are condition if that product could be added / could not to the cart.
4/ The results after PHP function will trigger the event in js 'added_to_cart' or not triggering if not added. Only after this step loader hides and green notifier is shown.
This question is better to adress to WooCommerce plugin but not for theme developers ( to us ).
Regards, Jack Richardson
Hello @Kazi, You may check default WooCommerce theme - Storefront -> https://themes.woocommerce.com/storefront/shop/ which will show you very similar results (I tester it and it was almost same). Adding to cart requires connection to php function that is working via ajax. In simple words adding to cart on servers (not localhosts) works in next way: 1/ Click on add to cart button 2/ In js scripts is started a call to the php function that is chained to that js action. (This step requires connection to server which is only with internet connection) 3/ Once that function was loaded - there are condition if that product could be added / could not to the cart. 4/ The results after PHP function will trigger the event in js 'added_to_cart' or not triggering if not added. Only after this step loader hides and green notifier is shown. This question is better to adress to WooCommerce plugin but not for theme developers ( to us ). Regards, Jack Richardson