• I have this code snippet to validate WC fields.

    add_filter( 'woocommerce_add_to_cart_validation', 'validate_fields', 1, 3 );
    function validate_fields( $passed, $product_id, $pid = null) {
      	global $woocommerce;
    
    	if( isset( $pid ) ) {
    		$all_fields = apply_filters( 'wcff/load/all_fields', $product_id );
    		foreach ( $all_fields as $fields ) {
    			foreach ( $fields as $field ) {
    				// my validation code here
    			}
    		}
    	}
    	return $passed;
    }

    It use to work fine but after updating to Version 2.0.6 I get the following error message:

    Warning: Invalid argument supplied for foreach() in...

    Did anything change in the API that would explain this?

The topic ‘Field Validation fails after update’ is closed to new replies.