My WP e-commerce site is displaying an error to iPhone users “Sorry, something went wrong. Please try again!” whenever someone clicks “add to cart”

[ad_1]

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:

https://imgtr.ee/image/screenshot-2.hhl4fG

https://imgtr.ee/image/screenshot.hhleLe

[ad_2]
3 Comments
  1. 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 );

  2. Could be something else, but to start, you shouldn’t block `/wp-admin/admin-ajax.php` in Cloudflare.

  3. 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?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer