WooCommerce Code Reference
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hook Reference
  • WooCommerce Docs
  • REST API Docs

Packages

  • None
  • WooCommerce
    • Abstracts
    • Admin
      • Customize
      • Functions
      • Importers
      • Meta
      • Reports
      • System
    • API
    • Classes
      • Data
        • Store
      • Emails
      • Embed
      • Integrations
      • Interfaces
      • Log
        • Handlers
      • Payment
      • Products
      • Shipping
      • Walkers
    • Export
    • Functions
    • Import
    • l10n
    • PaymentTokens
    • PayPal
    • Shortcodes
      • Cart
      • Checkout
      • My
        • Account
      • Order
        • Tracking
    • Webhooks
    • Widgets
  • WP-Background-Processing

Classes

  • Abstract_WC_Order_Data_Store_CPT
  • WC_Abstract_Order
  • WC_AJAX
  • WC_Autoloader
  • WC_Background_Emailer
  • WC_Background_Process
  • WC_Background_Updater
  • WC_Breadcrumb
  • WC_Cache_Helper
  • WC_Cart
  • WC_Cart_Fees
  • WC_Cart_Session
  • WC_Cart_Totals
  • WC_Checkout
  • WC_Coupon
  • WC_Customer
  • WC_Customer_Download
  • WC_Customer_Download_Log
  • WC_DateTime
  • WC_Discounts
  • WC_Download_Handler
  • WC_Geo_IP
  • WC_Geo_IP_Record
  • WC_Geolocation
  • WC_HTTPS
  • WC_Install
  • WC_Legacy_Cart
  • WC_Legacy_Coupon
  • WC_Legacy_Customer
  • WC_Legacy_Payment_Token
  • WC_Legacy_Shipping_Zone
  • WC_Legacy_Webhook
  • WC_Log_Levels
  • WC_Logger
  • WC_Order
  • WC_Order_Data_Store_CPT
  • WC_Order_Factory
  • WC_Order_Item
  • WC_Order_Item_Coupon
  • WC_Order_Item_Fee
  • WC_Order_Item_Meta
  • WC_Order_Item_Product
  • WC_Order_Item_Shipping
  • WC_Order_Item_Tax
  • WC_Order_Query
  • WC_Order_Refund
  • WC_Payment_Gateway_CC
  • WC_Payment_Gateway_eCheck
  • WC_Payment_Tokens
  • WC_Product_Attribute
  • WC_Product_Data_Store_CPT
  • WC_Product_Download
  • WC_Product_Factory
  • WC_Product_Query
  • WC_Product_Variable_Data_Store_CPT
  • WC_Product_Variation
  • WC_Query
  • WC_Regenerate_Images
  • WC_Regenerate_Images_Request
  • WC_Register_WP_Admin_Settings
  • WC_Session_Handler
  • WC_Shipping_Zone
  • WC_Shipping_Zones
  • WC_Shortcodes
  • WC_Structured_Data
  • WC_Tax
  • WC_Template_Loader
  • WC_Tracker
  • WC_Twenty_Eleven
  • WC_Twenty_Fifteen
  • WC_Twenty_Fourteen
  • WC_Twenty_Seventeen
  • WC_Twenty_Sixteen
  • WC_Twenty_Ten
  • WC_Twenty_Thirteen
  • WC_Twenty_Twelve
  • WC_Validation

Class WC_Validation

Contains Validation functions

Package: WooCommerce\Classes
Category: Class
Author: WooThemes
Version: 2.4.0
Class: WC_Validation
Located at class-wc-validation.php

Methods summary

public static boolean
# is_email( string $email )

Validates an email using WordPress native is_email function.

Validates an email using WordPress native is_email function.

Parameters

$email
Email address to validate.

Returns

boolean
public static boolean
# is_phone( string $phone )

Validates a phone number using a regular expression.

Validates a phone number using a regular expression.

Parameters

$phone
Phone number to validate.

Returns

boolean
public static boolean
# is_postcode( string $postcode, string $country )

Checks for a valid postcode.

Checks for a valid postcode.

Parameters

$postcode
Postcode to validate.
$country
Country to validate the postcode for.

Returns

boolean
public static boolean
# is_GB_postcode( string $to_check )

Check if is a GB postcode.

Check if is a GB postcode.

Parameters

$to_check
A postcode

Returns

boolean

Author

John Gardner
public static string
# format_postcode( string $postcode, string $country )

Format the postcode according to the country and length of the postcode.

Format the postcode according to the country and length of the postcode.

Parameters

$postcode
Postcode to format.
$country
Country to format the postcode for.

Returns

string
Formatted postcode.
public static string
# format_phone( mixed $tel )

format_phone function.

format_phone function.

Parameters

$tel
Phone number to format.

Returns

string
WooCommerce Code Reference API documentation generated by ApiGen