Support » Plugin: WooCommerce » Parse error: syntax error, unexpected ‘:’, expecting error is showing

  • Resolved adii123


    hi, i have updated the woocommerce to latest version. this error is appearng

    Parse error: syntax error, unexpected ‘:’, expecting ‘{‘ in /public_html/wp-content/plugins/woocommerce/woocommerce.php on line 56

    on this function
    function wc_get_container() : \Psr\Container\ContainerInterface {
    return $GLOBALS[‘wc_container’];

    Please help me inresolving this issue

Viewing 10 replies - 16 through 25 (of 25 total)
  • I’m having simular issue but on the line 57 with both PHP 7.3 and 7.4

    Parse error: syntax error, unexpected ‘:’, expecting ‘{‘ in /public_html/wp-content/plugins/woocommerce/woocommerce.php on line 57

    Reinstalled WooCommerce a few time but it’s still coming up.
    Would realy appreciate if this gets solved.



    I have this parse error on line 57 too. I have spoken to woocommerce several time over the past few months to no avail. I have deactivated plugin, upgraded software, upgraded php and still the problem occurs, my client is now, understandably, getting a little frustrated. Has anyone found an answer to this error?

    also getting this issue… what do we dooo?


    I updated my php to past version 7.2 and it works. Hope that helps.

    Thank you to whoever suggested upgrading the PHP version! You saved me hours of work. Upgraded to 7.4 and worked.

    I’m running PHP 7.4+ and still having this issue. Is there some configuration in the php.ini file that needs to be tweaked or something? This is breaking a lot of sites. I can’t update past PHP 7.4 right now. But according to this thread, it should be working. Anyone?

    Hi, I’m getting the same error, over and over again, every update to any plugin keeps initiating the same error.

    [16-Jun-2021 23:00:50 UTC] PHP Parse error: syntax error, unexpected ‘:’, expecting ‘{‘ in /home/——/public_html/wp-content/plugins/woocommerce/woocommerce.php on line 57

    We’re running PHP Version 7.4, the “latest” version required by WordPress and WooCommerce.

    Why isn’t WooCommerce fixing this with an update that works?
    Is it a WordPress issue?
    What is the solution here?

    Sooo many people with the same problem deserve some action surely.

    Am experiencing this issue out of nowhere. No changes or recent notifications of any automatic updates to our site. It says the error is occuring at the login page, which means I can’t login to my admin panel. Am running PHP 7.4.20

    I am going to have to use a backup to restore the site and looks like my only option is to somehow deactivate and remove the WooCommerce component that we aren’t even currently using.

    I got this too when trying to use WP-CLI search-replace.
    unexpected ‘:’, expecting ‘{‘ in /public_html/site/wp-content/plugins/woocommerce/woocommerce.php on line 57

    Solutions? Ideas?

    Plugin Support Mirko P.


    Hello @argentum,

    Please create your own thread since this one is technically resolved. We want to make sure that every user’s issues receive their own thread with proper attention.


Viewing 10 replies - 16 through 25 (of 25 total)
  • You must be logged in to reply to this topic.