• Some of my woocommerce ajax requests are now failing. Requests to /?wc-ajax=add_to_cart come back empty, but not always.

    I’m not sure how this plugin is causing it, but it only started after updating to 2.50 and disabling this plugin stops the error from occurring.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Kevin Hagerty

    (@khag7)

    If I comment out line 146 of class-wpel-front.php then everything works fine.

    $content = preg_replace_callback( $regexp_link, $this->get_callback( 'match_link' ), $content );

    This leads me to believe that preg_replace_callback is failing in some way. Potentially wrap this in a try/catch? When this fails during an ajax call, the ajax response returns empty. Ideally, instead, with a try/catch, if the try fails, then the catch should be to just return the original modified content

    • This reply was modified 3 years, 4 months ago by Kevin Hagerty.
    Plugin Author WebFactory

    (@webfactory)

    Thank you for letting us know. We’ll look into this!

    Same Issue here, is there a work around that is ready ?

    Thread Starter Kevin Hagerty

    (@khag7)

    The more I looked into this, the more I realize it has nothing to do with the update to 2.50. I had some ajax requests failing almost a year ago that I could never figure out what the cause was. From what I had time to debug (before just disabling this plugin) it seemed that once the HTML I was passing to preg_replace_callback was large enough, it started to fail. The HTML I passed had some escaped characters that may have had an issue, I don’t know, ran out of energy/time to figure it out.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Update to 2.50 causes some ajax requests to fail’ is closed to new replies.