The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Fatal error: WC_Validation::format_phone() in... (1 post)

  1. chesneyryan
    Posted 3 years 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:

    						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??


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic