bmadm
Forum Replies Created
-
Hi,Thanks a lot for the help and your reply. I’ve just set up the cron job on the server using the updated purge_all version of the script.
Hopefully, this will solve the issue. I really appreciate your support!
Best regards
Hi, the “Nonce verification failed” error kept appearing consistently, and unfortunately running the purge.php script to clear ESI cache did not resolve it.However, once I manually cleared JS and CSS cache via LiteSpeed settings, the error disappeared.
This suggests the issue might be related to those cache layers rather than ESI alone.
Is there perhaps a script that can clear all LiteSpeed cache types (not just ESI) that I could try via cron or manually?
Thanks!
Hi,sorry for the delayed reply – I didn’t get an email notification, so I’ve just seen your message today.Thanks for the suggestion! I’ll try it as soon as the issue happens again and will let you know what I observe.
Best regards,
Hi again,
Unfortunately, the error appeared again today: “Nonce verification failed.”It seemed stable for the past few days, but now it’s back.
Thanks again for your support!
Hi,The error hasn’t occurred for the past three days, so it looks like the issue has been resolved. Thank you very much for your help!I’ll continue testing until the end of the week just to be sure.
Best regards,
I’ve enabled ESI and added pls_nonce to the ESI Nonce list. I’ll monitor it for the next couple of days and let you know how it goes. Thanks for the tip!
if ( ! function_exists( 'pls_ajax_add_to_cart' ) ) {
/**
* Ajax Add to Cart
*/
function pls_ajax_add_to_cart(){
// Get messages
ob_start();
wc_print_notices();
$notices = ob_get_clean();
// Get fragments
// Get mini cart
ob_start();
woocommerce_mini_cart();
$mini_cart = ob_get_clean();
// Fragments and mini cart are returned
$data = array(
'notices' => $notices,
'fragments' => apply_filters( 'woocommerce_add_to_cart_fragments', array(
'div.widget_shopping_cart_content' => '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>'
)
),
'cart_hash' => apply_filters( 'woocommerce_add_to_cart_hash', WC()->cart->get_cart_for_session() ? md5( json_encode( WC()->cart->get_cart_for_session() ) ) : '', WC()->cart->get_cart_for_session() )
);
wp_send_json( $data );
die();
}
add_action( 'wp_ajax_pls_ajax_add_to_cart', 'pls_ajax_add_to_cart' );
add_action( 'wp_ajax_nopriv_pls_ajax_add_to_cart', 'pls_ajax_add_to_cart' );
}Let me know if you need any more lines or a different snippet.
Hi, I’m sending you the wc-core-functions.php and functions.js files as attachments because there’s quite a lot of code involved. The wc-core-functions.php file contains many more functions related to this issue, so I wanted to provide the full context.
https://we.tl/t-1JmYNvbA4U or https://drive.google.com/drive/folders/10UA8_fkU8K1oQeuxXYMNpGrpl_FZtj9Q?usp=drive_link
I found the
pls_ajax_add_to_cartaction in the theme JavaScript file. It sends an Ajax request with the nonce parameterpls_options.nonce.Here’s the snippet (function.js):
var data = {
action : ‘pls_ajax_add_to_cart’,
‘add-to-cart’ : product_id,
nonce : pls_options.nonce,
};Yes, exactly.I have been constantly testing different options — with ESI enabled and disabled, turning off minification, excluding JS files, and also enabling and disabling the Load JS Deferred feature — but so far nothing has helped.
Hello,
The first report, which includes a link to the variable product, has been sent in the “Notes” section:
Last Report Number: OZFIGECZ
Last Report Date: 05/30/2025 18:00:02The second report is from another website that has the same problem:
Last Report Number: SOZFBKEO
Last Report Date: 05/30/2025 18:00:25Please let me know if you need any further information.
Thank you!
Best regards,
You have to reload the block and reconfigure it – it helped.