WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Fatal error: WC_Validation::format_phone() in... (2 posts)

  1. chesneyryan
    Member
    Posted 1 year ago #

    Please help,

    I'm getting this error "Fatal error: Call to undefined method WC_Validation::format_phone() in /home/.../..."

    It tells me to go to line 222 of "class-wc-checkout.php" which reads this:

    $this->posted[ $key ] = $validation->format_phone( $this->posted[ $key ] );

    Here is the entire section of code:

    break;
    						case "billing_phone" :
    
    							$this->posted[ $key ] = $validation->format_phone( $this->posted[ $key ] );
    
    							if ( ! $validation->is_phone( $this->posted[ $key ] ) )
    								$woocommerce->add_error( '<strong>' . $field['label'] . '</strong> ' . __('is not a valid number.', 'woocommerce') );

    Perhaps the validation is messed up? This is what is in "class-wc-validation.php"

    /**
    	 * Validates a phone number using a regular expression
    	 *
    	 * @param   string	phone number
    	 * @return  boolean
    	 */
    	function is_phone( $phone ) {
    		if (strlen(trim(preg_replace('/[\s\#0-9_\-\+\(\)]/', '', $phone)))>0) return false;
    		return true;
    	}

    Does that look correct? Please someone help me make sense of this! Should that be normal after a new install of the plugin??

    http://wordpress.org/extend/plugins/woocommerce/

  2. chesneyryan
    Member
    Posted 1 year ago #

    Anyone???

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic