• Resolved aisupportteam

    (@aisupportteam)


    Hi guys,

    I’m having problem with this Class WC Background Process. When I run the WooCommerce Data Update it stuck. I have check the error_logs and it says:

    PHP Warning: Invalid argument supplied for foreach() in /home/demolate888/public_html/wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php on line 101

    Here’s the code for line 101:

    foreach ( $batch->data as $key => $value ) {
    	$task = $this->task( $value );
    
    	if ( false !== $task ) {
    		$batch->data[ $key ] = $task;
    	} else {
    		unset( $batch->data[ $key ] );
    	}
    
    	if ( $this->batch_limit_exceeded() ) {
    		// Batch limits reached.
    		break;
    	}
    }

    What shoud I do to fix this problem?

    Any help very much appreciated.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Replace of code of line 101 with this code. It will remove this warning of code.

    if(count($batch->data)){
    foreach ( $batch->data as $key => $value ) {
    	$task = $this->task( $value );
    
    	if ( false !== $task ) {
    		$batch->data[ $key ] = $task;
    	} else {
    		unset( $batch->data[ $key ] );
    	}
    
    	if ( $this->batch_limit_exceeded() ) {
    		// Batch limits reached.
    		break;
    	}
    }
    }
    Thread Starter aisupportteam

    (@aisupportteam)

    Thanks for the reply @mdshak

    Yes, It will remove the warning but in the dashboard still this will display “WooCommerce data update – Your database is being updated in the background”.

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Probably best to find the underlining cause. As issues are temporarily caused by a plugin/theme conflict, let’s start there. Follow this guide to perhaps find a conflicting plugin or theme: https://docs.woocommerce.com/document/woocommerce-self-service-guide/#section-4

    • This reply was modified 8 years, 1 month ago by Caleb Burks.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Class WC Background Process on line 101’ is closed to new replies.