• Resolved shyamzin

    (@shyamzin)


    Hello Support,

    We have a critical error after the plugin version update from 8.4.0 to 8.5.0. Below is the error we are getting and this is getting triggered when the User profile is updating via admin.

    An error of type E_ERROR was caused in line 146 of the file /wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-addresses.php. Error message: Uncaught Error: Call to undefined function wc_notice_count() in /wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-addresses.php:146

    I have checked with 8.4 and no issues over there. So its clearly the version 8.5.0 causing the issue.

    Please look into this asap as there are many WooCommerce stores having subscription plugin installed and configured.

    The issue exists in the 8.5.1 version as well.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Support Sandip Mondal – a11n

    (@sandipmondal)

    Hi @shyamzin,

    We have received reports about WooCommerce 8.5.1’s incompatibility with the Stripe extension (version 7.9.0)  and Woo Subscriptions 5.9.0, which causes this fatal error when updating the customer profile:

    PHP Fatal error: Uncaught Error: Call to undefined function wc_add_notice()
    
    

    The issue had already been fixed in Stripe 7.9.1 and Woo Subscriptions 5.9.1which was released yesterday and today respectively.

    Please update WooCommerce as well the above extensions (if you have any of them) and the error should go resolved.

    Let us know how it goes!

    @sandipmondal — for extensions that are so widely used with WooCommerce, like Stripe and Woo Subscriptions, would it be possible to do thorough testing internally with such extensions in the future, before releasing updates that may be incompatible?

    @sandipmondal you’re making too much sense and asking too much ??

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi Everyone,

    Along with Sandip’s advice, I encourage you to follow the guide shared on our dev blog. It may provide you with more assistance to tackle your problem:: https://developer.woo.com/2024/01/16/woocommerce-8-5-1-issues-with-web-application-firewalls-modsecurity/

    I hope this helps! Please let us know how it goes or if you need further assistance.

    Thread Starter shyamzin

    (@shyamzin)

    Hi Shameem,

    So if we disable Order Attribution feature, this issue wont occur – right? Please confirm.

    Plugin Support Beauty of Code (woo-hc)

    (@beautyofcode)

    Hey @shyamzin,

    So if we disable Order Attribution feature, this issue wont occur – right? Please confirm.

    Disabling the “Order Attribution” feature in the meantime should resolve the issue temporarily while our developers work on a solution.

    The support guide below provides steps on how to disable this feature:

    Cheers!

    megiste

    (@megiste)

    Hello, we did everything you suggest above but no effect… Further help would be appreciated. Thanks in advance.

    satoshinet

    (@satoshinet)

    Were having this issue and need HELP ASAP, We also did everything you suggest above but no effect.

    Can we rollback the woocomerce plugin to fix this?

    • This reply was modified 10 months ago by satoshinet.
    • This reply was modified 10 months ago by satoshinet.
    Thread Starter shyamzin

    (@shyamzin)

    @megiste @satoshinet please rollback to 8.4, this will fix the issue. For me, i have upgraded Woocommerce and Woocommerce subscriptions plugin to latest available version and the issue got fixed.

    satoshinet

    (@satoshinet)

    We are all updated to the newest everything and it is not working,

    megiste

    (@megiste)

    The same for us… Please help !!!

    Thread Starter shyamzin

    (@shyamzin)

    What about stripe plugin? @satoshinet @megiste

    Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello megiste, satoshinet

    Thank you for contacting WooCommerce support.

    Since all the websites are built differently, it will be better to look into your issues separately. Therefore, I will suggest creating New Topics for your issues so we can assist you in a better way.

    Appreciate your cooperation. ??

    @sathoshinet

    After updating the plugins, we still have a strange redirection issue, but I found the issue.
    We have an action on ‘woocommerce_customer_save_address’ and I thing this action is now called in the admin when you save a profile, and I guess that was not the case before a recent WooCommerce update.
    So, our solution was just to add a “if (!is_admin() )” on our woocommerce_customer_save_address action.

    I hope it could help someone else ??

    • This reply was modified 9 months, 3 weeks ago by STBANz.
    if(  !function_exists('wc_notice_count')  ){
      function wc_notice_count( $notice_type = '' ) {
    	if ( ! did_action( 'woocommerce_init' ) ) {
    		wc_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' );
    		return;
    	}
    
    	$notice_count = 0;
    	$all_notices  = WC()->session->get( 'wc_notices', array() );
    
    	if ( isset( $all_notices[ $notice_type ] ) && is_array( $all_notices[ $notice_type ] ) ) {
    
    		$notice_count = count( $all_notices[ $notice_type ] );
    
    	} elseif ( empty( $notice_type ) ) {
    
    		foreach ( $all_notices as $notices ) {
    			if ( is_countable( $notices ) ) {
    				$notice_count += count( $notices );
    			}
    		}
    	}
    
    	return $notice_count;
      }
    }

    This is not ideal, so hopefully they will fix this soon. This is still happening for me. But if you paste this in your functions.php file, it should fix the error. This is just the missing function copied and pasted from Woocommerce Core. We first check if the function exists, and if not then woocommerce will use the version of the function contained in my code block. Once again this is not ideal but should fix the issue temporarily until a real fix is implemented.

    The original function can be found here;
    https://github.com/woocommerce/woocommerce/blob/2f6818772e9562df7b745cbb2f235a127329d19e/plugins/woocommerce/includes/wc-notice-functions.php#L23

    • This reply was modified 9 months, 1 week ago by Verb_Form04.
Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Critical Error – Call to undefined fn wc_notice_count() – After plugin update’ is closed to new replies.