My website is https://tugapharma.shop/ and it's been displaying issues on the cart page. (check screenshots below of the error displaying)
These issues were noticed after I changed these things on my functions.php file:
Initially I added some custom code for my customers to checkout through Whatsapp as that's where I conduct business. Everything was fine.
Then I noticed the cart page wasn't updating and I had to rebuild the pages to to fix it. Now it's fixed. The cart page works, updates, etc.
Then this new error message "Sorry, something went wrong. Please try again!" started.
I initially thought it was because my add_to_cart_fragments was being used and it has been deprecated since version 3.0.0! So I needed woocommerce_add_to_cart_fragments instead. I couldn't find the "add_to_cart_fragments" in my file manager so I added a custom code to my functions.php file:
add_filter('woocommerce_add_to_cart_fragments', 'update_cart_fragments');
function update_cart_fragments($fragments) { ob_start(); ?> <?php echo sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'text-domain'), WC()->cart->get_cart_contents_count());?> - <?php echo WC()->cart->get_cart_total(); ?> <?php $fragments['a.cart-contents'] = ob_get_clean(); return $fragments; }
And this code fixed it! (TEMPORARILY, like I said)
After 30 minutes and now the error is showing up again.
Can someone please help me?
ERROR SCREENSHOT LINKS:
Turn on debugging display in your wp-config.php file to see what the error is:
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_DISPLAY’, true );
Could be something else, but to start, you shouldn’t block `/wp-admin/admin-ajax.php` in Cloudflare.
It’s nice that you’ve included screenshots. there’s a POST request failing with an error. There’s an arrow. can you click to see what error was that returning?