Hi @afzalpansuvi,
i tested wp on my localhost server again
-i not using any other plugins (in plugin folder only use woocommerce plugin) i have clean fresh default install of WP Version: 6.4.3 and WC Version: 8.6.1 and storefront (Version: 4.5.4)
-i put this code on storefront function.php make sure this -cart-fragments.js or cart-fragments.min.js is invoked but i think is not working somehow.
here is some info : https://developer.woo.com/2023/06/16/best-practices-for-the-use-of-the-cart-fragments-api/
function enqueue_wc_cart_fragments() { wp_enqueue_script( 'wc-cart-fragments' ); }
add_action( 'wp_enqueue_scripts', 'enqueue_wc_cart_fragments' );
-when i press add to cart button on main shop page the mini-cart count is updating.
-only in Cart page when removing items or use +/- button the mini-cart counter not works (not changing at all)
-chrome and firefox console no any error (Inspect mode)
-i turned on wp errors on wp-config.php no any errors
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_DISPLAY’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘SCRIPT_DEBUG’, true );
-i restarted the server and tested again the error logs no errors generated only this:
access log output:
127.0.0.1 - - [15/Mar/2024:10:27:01 +0100] "POST /wp-cron.php?doing_wp_cron=1710494821.3560891151428222656250 HTTP/1.1" 200 259 "-" "WordPress/6.4.3; https://localhost"
127.0.0.1 - - [15/Mar/2024:10:27:00 +0100] "POST /?wc-ajax=add_to_cart HTTP/1.1" 200 3786 "https://localhost/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:27:01 +0100] "POST /?wc-ajax=get_refreshed_fragments HTTP/1.1" 200 3709 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:27:02 +0100] "POST /?wc-ajax=add_to_cart HTTP/1.1" 200 3785 "https://localhost/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:27:02 +0100] "POST /?wc-ajax=get_refreshed_fragments HTTP/1.1" 200 3709 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:27:04 +0100] "GET /index.php/cart/ HTTP/1.1" 200 63151 "https://localhost/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:27:08 +0100] "POST /index.php/wp-json/wc/store/v1/batch?_locale=user HTTP/1.1" 207 4779 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:27:10 +0100] "POST /index.php/wp-json/wc/store/v1/batch?_locale=user HTTP/1.1" 207 3606 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:27:20 +0100] "POST /wp-cron.php?doing_wp_cron=1710494840.9453849792480468750000 HTTP/1.1" 200 259 "-" "WordPress/6.4.3; https://localhost"
::1 - - [15/Mar/2024:10:27:20 +0100] "POST /?wc-ajax=add_to_cart HTTP/1.1" 200 3767 "https://localhost/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
::1 - - [15/Mar/2024:10:27:24 +0100] "POST /?wc-ajax=add_to_cart HTTP/1.1" 200 3768 "https://localhost/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
::1 - - [15/Mar/2024:10:27:26 +0100] "GET /index.php/cart/ HTTP/1.1" 200 61656 "https://localhost/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
::1 - - [15/Mar/2024:10:27:27 +0100] "GET /index.php/checkout/ HTTP/1.1" 200 60620 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
::1 - - [15/Mar/2024:10:27:30 +0100] "POST /index.php/wp-json/wc/store/v1/batch?_locale=user HTTP/1.1" 207 4695 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
::1 - - [15/Mar/2024:10:27:32 +0100] "POST /index.php/wp-json/wc/store/v1/batch?_locale=user HTTP/1.1" 207 4695 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
::1 - - [15/Mar/2024:10:27:33 +0100] "POST /index.php/wp-json/wc/store/v1/batch?_locale=user HTTP/1.1" 207 3523 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
127.0.0.1 - - [15/Mar/2024:10:27:51 +0100] "POST /wp-cron.php?doing_wp_cron=1710494871.0212891101837158203125 HTTP/1.1" 200 259 "-" "WordPress/6.4.3; https://localhost"
::1 - - [15/Mar/2024:10:27:50 +0100] "POST /index.php/wp-json/wc/store/v1/batch?_locale=user HTTP/1.1" 207 3524 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
127.0.0.1 - - [15/Mar/2024:10:28:04 +0100] "GET /index.php/cart/ HTTP/1.1" 200 63037 "https://localhost/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:28:05 +0100] "POST /?wc-ajax=get_refreshed_fragments HTTP/1.1" 200 2718 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:28:06 +0100] "POST /?wc-ajax=get_refreshed_fragments HTTP/1.1" 200 2718 "https://localhost/index.php/cart/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:28:24 +0100] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 592 "https://localhost/wp-admin/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [15/Mar/2024:10:28:25 +0100] "POST /wp-admin/admin-ajax.php?action=as_async_request_queue_runner&nonce=35ee993cfe HTTP/1.1" 200 413 "-" "WordPress/6.4.3; https://localhost"
-apache error log:
[Fri Mar 15 10:26:33.676904 2024] [mpm_prefork:notice] [pid 16707] AH00163: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations
[Fri Mar 15 10:26:33.676991 2024] [core:notice] [pid 16707] AH00094: Command line: '/usr/sbin/apache2'