I have activated the FastCgi Cache, Redis Cache. Have a problem, when I add a product in the affection, the plugin WP Menu Cart shows the value and quantity of products added in the cart, the problem is that when I click on any Page on my website wordpress the information that was in the top right bar shown by the WP Menu Cart plugin as the total value and quantity of products plummet. I used the cache on the server code:
WPFC-WOOCOMMERCE NGINX CONFIGURATION
set $skip_cache 0;
if ($request_uri ~* "/checkout.|/checkout/purchase-confirmation.|/checkout.*") {
set $skip_cache 1;
}
POST requests and URL with a query string should always go to php
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
Don't cache URL containing the following segments
if ($request_uri ~* "(/carrinho.|/minha-conta.|/finalizar-compra.|/addons.|/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(index)?.xml|[a-z0-9-]+-sitemap([0-9]+)?.xml)") {
set $skip_cache 1;
}
Don't use the cache for logged in users or recent commenter
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
Use cached or actual file if they exists, Otherwise pass request to WordPress
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .php$ {
set $rt_session "";
if ($http_cookie ~* "wp_woocommerce_session_[^=]*=([^%]+)%7C") {
set $rt_session wp_woocommerce_session_$1;
}
if ($skip_cache = 0 ) {
more_clear_headers "Set-Cookie*";
set $rt_session "";
}
fastcgi_cache_key "$scheme$request_method$host$request_uri$rt_session";
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache WORDPRESS;
fastcgi_cache_valid 60m;
}
location ~ /purge(/.*) {
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
}