PHP Класс WC_Customer

Автор: WooThemes
Наследование: extends WC_Legacy_Customer
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$calculated_shipping string Stores if user has calculated shipping in this session.
$data array Stores customer data.
$is_vat_exempt string Stores if user is VAT exempt for this session.
$password string Stores a password if this needs to be changed. Write-only and hidden from _data.

Открытые методы

Метод Описание
__construct ( WC_Customer | integer $data, boolean $is_session = false ) Load customer data based on how WC_Customer is called.
delete_and_reassign ( integer $reassign = null ) : boolean Delete a customer and reassign posts.
get_avatar_url ( ) : string Return this customer's avatar.
get_billing_address ( string $context = 'view' ) : string Get billing_address_1.
get_billing_address_1 ( string $context = 'view' ) : string Get billing_address_1.
get_billing_address_2 ( string $context = 'view' ) : string Get billing_address_2.
get_billing_city ( string $context = 'view' ) : string Get billing_city.
get_billing_company ( string $context = 'view' ) : string Get billing_company.
get_billing_country ( string $context = 'view' ) : string Get billing_country.
get_billing_email ( string $context = 'view' ) : string Get billing_email.
get_billing_first_name ( string $context = 'view' ) : string Get billing_first_name.
get_billing_last_name ( string $context = 'view' ) : string Get billing_last_name.
get_billing_phone ( string $context = 'view' ) : string Get billing_phone.
get_billing_postcode ( string $context = 'view' ) : string Get billing_postcode.
get_billing_state ( string $context = 'view' ) : string Get billing_state.
get_calculated_shipping ( ) : boolean Has customer calculated shipping?
get_date_created ( string $context = 'view' ) : integer Return the date this customer was created.
get_date_modified ( string $context = 'view' ) : integer Return the date this customer was last updated.
get_downloadable_products ( ) : array Gets a customer's downloadable products.
get_email ( string $context = 'view' ) : string Return the customer's email.
get_first_name ( string $context = 'view' ) : string Return customer's first name.
get_is_paying_customer ( string $context = 'view' ) : boolean Is the user a paying customer?
get_is_vat_exempt ( ) : boolean Get if customer is VAT exempt?
get_last_name ( string $context = 'view' ) : string Return customer's last name.
get_last_order ( ) : WC_Order | false Gets the customers last order.
get_order_count ( ) : integer Return the number of orders this customer has.
get_password ( ) : string Get password (only used when updating the user object).
get_role ( string $context = 'view' ) : string Return customer's user role.
get_shipping_address ( string $context = 'view' ) : string Get shipping_address_1.
get_shipping_address_1 ( string $context = 'view' ) : string Get shipping_address_1.
get_shipping_address_2 ( string $context = 'view' ) : string Get shipping_address_2.
get_shipping_city ( string $context = 'view' ) : string Get shipping_city.
get_shipping_company ( string $context = 'view' ) : string Get shipping_company.
get_shipping_country ( string $context = 'view' ) : string Get shipping_country.
get_shipping_first_name ( string $context = 'view' ) : string Get shipping_first_name.
get_shipping_last_name ( string $context = 'view' ) : string Get shipping_last_name.
get_shipping_postcode ( string $context = 'view' ) : string Get shipping_postcode.
get_shipping_state ( string $context = 'view' ) : string Get shipping_state.
get_taxable_address ( ) : array Get taxable address.
get_total_spent ( ) : float Return how much money this customer has spent.
get_username ( string $context = 'view' ) : string Return the customer's username.
has_calculated_shipping ( ) : boolean Has calculated shipping?
is_customer_outside_base ( ) : boolean Is customer outside base country (for tax purposes)?
is_vat_exempt ( ) : boolean Is customer VAT exempt?
set_billing_address ( string $value ) Set billing_address_1.
set_billing_address_1 ( string $value ) Set billing_address_1.
set_billing_address_2 ( string $value ) Set billing_address_2.
set_billing_address_to_base ( ) Set customer address to match shop base address.
set_billing_city ( string $value ) Set billing_city.
set_billing_company ( string $value ) Set billing_company.
set_billing_country ( string $value ) Set billing_country.
set_billing_email ( string $value ) Set billing_email.
set_billing_first_name ( string $value ) Set billing_first_name.
set_billing_last_name ( string $value ) Set billing_last_name.
set_billing_location ( string $country, string $state, string $postcode = '', string $city = '' ) Sets all address info at once.
set_billing_phone ( string $value ) Set billing_phone.
set_billing_postcode ( string $value ) Set billing_postcode.
set_billing_state ( string $value ) Set billing_state.
set_calculated_shipping ( boolean $calculated = true ) Calculated shipping?
set_date_created ( integer $timestamp ) Set the date this customer was last updated.
set_date_modified ( integer $timestamp ) Set the date this customer was last updated.
set_email ( string $value ) Set customer's email.
set_first_name ( string $first_name ) Set customer's first name.
set_is_paying_customer ( boolean $is_paying_customer ) Set if the user a paying customer.
set_is_vat_exempt ( boolean $is_vat_exempt ) Set if customer has tax exemption.
set_last_name ( string $last_name ) Set customer's last name.
set_password ( string $password ) Set customer's password.
set_role ( mixed $role ) Set customer's user role(s).
set_shipping_address ( string $value ) Set shipping_address_1.
set_shipping_address_1 ( string $value ) Set shipping_address_1.
set_shipping_address_2 ( string $value ) Set shipping_address_2.
set_shipping_address_to_base ( ) Set customer shipping address to base address.
set_shipping_city ( string $value ) Set shipping_city.
set_shipping_company ( string $value ) Set shipping_company.
set_shipping_country ( string $value ) Set shipping_country.
set_shipping_first_name ( string $value ) Set shipping_first_name.
set_shipping_last_name ( string $value ) Set shipping_last_name.
set_shipping_location ( string $country, string $state = '', string $postcode = '', string $city = '' ) Sets all shipping info at once.
set_shipping_postcode ( string $value ) Set shipping_postcode.
set_shipping_state ( string $value ) Set shipping_state.
set_username ( string $username ) Set customer's username.

Защищенные методы

Метод Описание
get_address_prop ( string $prop, string $address = 'billing', string $context = 'view' ) : mixed Gets a prop for a getter method.
get_hook_prefix ( ) : string Prefix for action and filter hooks on data.
set_address_prop ( string $prop, string $address = 'billing', mixed $value ) Sets a prop for a setter method.

Описание методов

__construct() публичный Метод

If $customer is 'new', you can build a new WC_Customer object. If it's empty, some data will be pulled from the session for the current user/customer.
public __construct ( WC_Customer | integer $data, boolean $is_session = false )
$data WC_Customer | integer Customer ID or data.
$is_session boolean True if this is the customer session

delete_and_reassign() публичный Метод

.
С версии: 2.7.0
public delete_and_reassign ( integer $reassign = null ) : boolean
$reassign integer Reassign posts and links to new User ID.
Результат boolean

get_address_prop() защищенный Метод

Gets a prop for a getter method.
С версии: 2.7.0
protected get_address_prop ( string $prop, string $address = 'billing', string $context = 'view' ) : mixed
$prop string Name of prop to get.
$address string billing or shipping.
$context string What the value is for. Valid values are view and edit.
Результат mixed

get_avatar_url() публичный Метод

Return this customer's avatar.
С версии: 2.7.0
public get_avatar_url ( ) : string
Результат string

get_billing_address() публичный Метод

Get billing_address_1.
public get_billing_address ( string $context = 'view' ) : string
$context string
Результат string

get_billing_address_1() публичный Метод

Get billing_address_1.
public get_billing_address_1 ( string $context = 'view' ) : string
$context string
Результат string

get_billing_address_2() публичный Метод

Get billing_address_2.
public get_billing_address_2 ( string $context = 'view' ) : string
$context string
Результат string $value

get_billing_city() публичный Метод

Get billing_city.
public get_billing_city ( string $context = 'view' ) : string
$context string
Результат string $value

get_billing_company() публичный Метод

Get billing_company.
public get_billing_company ( string $context = 'view' ) : string
$context string
Результат string

get_billing_country() публичный Метод

Get billing_country.
public get_billing_country ( string $context = 'view' ) : string
$context string
Результат string

get_billing_email() публичный Метод

Get billing_email.
public get_billing_email ( string $context = 'view' ) : string
$context string
Результат string

get_billing_first_name() публичный Метод

Get billing_first_name.
public get_billing_first_name ( string $context = 'view' ) : string
$context string
Результат string

get_billing_last_name() публичный Метод

Get billing_last_name.
public get_billing_last_name ( string $context = 'view' ) : string
$context string
Результат string

get_billing_phone() публичный Метод

Get billing_phone.
public get_billing_phone ( string $context = 'view' ) : string
$context string
Результат string

get_billing_postcode() публичный Метод

Get billing_postcode.
public get_billing_postcode ( string $context = 'view' ) : string
$context string
Результат string

get_billing_state() публичный Метод

Get billing_state.
public get_billing_state ( string $context = 'view' ) : string
$context string
Результат string

get_calculated_shipping() публичный Метод

Has customer calculated shipping?
public get_calculated_shipping ( ) : boolean
Результат boolean

get_date_created() публичный Метод

Return the date this customer was created.
С версии: 2.7.0
public get_date_created ( string $context = 'view' ) : integer
$context string
Результат integer

get_date_modified() публичный Метод

Return the date this customer was last updated.
С версии: 2.7.0
public get_date_modified ( string $context = 'view' ) : integer
$context string
Результат integer

get_downloadable_products() публичный Метод

Gets a customer's downloadable products.
public get_downloadable_products ( ) : array
Результат array Array of downloadable products

get_email() публичный Метод

Return the customer's email.
С версии: 2.7.0
public get_email ( string $context = 'view' ) : string
$context string
Результат string

get_first_name() публичный Метод

Return customer's first name.
С версии: 2.7.0
public get_first_name ( string $context = 'view' ) : string
$context string
Результат string

get_hook_prefix() защищенный Метод

Prefix for action and filter hooks on data.
С версии: 2.7.0
protected get_hook_prefix ( ) : string
Результат string

get_is_paying_customer() публичный Метод

Is the user a paying customer?
С версии: 2.7.0
public get_is_paying_customer ( string $context = 'view' ) : boolean
$context string
Результат boolean

get_is_vat_exempt() публичный Метод

Get if customer is VAT exempt?
С версии: 2.7.0
public get_is_vat_exempt ( ) : boolean
Результат boolean

get_last_name() публичный Метод

Return customer's last name.
С версии: 2.7.0
public get_last_name ( string $context = 'view' ) : string
$context string
Результат string

get_last_order() публичный Метод

Gets the customers last order.
public get_last_order ( ) : WC_Order | false
Результат WC_Order | false

get_order_count() публичный Метод

Return the number of orders this customer has.
public get_order_count ( ) : integer
Результат integer

get_password() публичный Метод

Get password (only used when updating the user object).
public get_password ( ) : string
Результат string

get_role() публичный Метод

Return customer's user role.
С версии: 2.7.0
public get_role ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_address() публичный Метод

Get shipping_address_1.
public get_shipping_address ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_address_1() публичный Метод

Get shipping_address_1.
public get_shipping_address_1 ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_address_2() публичный Метод

Get shipping_address_2.
public get_shipping_address_2 ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_city() публичный Метод

Get shipping_city.
public get_shipping_city ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_company() публичный Метод

Get shipping_company.
public get_shipping_company ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_country() публичный Метод

Get shipping_country.
public get_shipping_country ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_first_name() публичный Метод

Get shipping_first_name.
public get_shipping_first_name ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_last_name() публичный Метод

Get shipping_last_name.
public get_shipping_last_name ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_postcode() публичный Метод

Get shipping_postcode.
public get_shipping_postcode ( string $context = 'view' ) : string
$context string
Результат string

get_shipping_state() публичный Метод

Get shipping_state.
public get_shipping_state ( string $context = 'view' ) : string
$context string
Результат string

get_taxable_address() публичный Метод

Get taxable address.
public get_taxable_address ( ) : array
Результат array

get_total_spent() публичный Метод

Return how much money this customer has spent.
public get_total_spent ( ) : float
Результат float

get_username() публичный Метод

Return the customer's username.
С версии: 2.7.0
public get_username ( string $context = 'view' ) : string
$context string
Результат string

has_calculated_shipping() публичный Метод

Has calculated shipping?
public has_calculated_shipping ( ) : boolean
Результат boolean

is_customer_outside_base() публичный Метод

Is customer outside base country (for tax purposes)?
public is_customer_outside_base ( ) : boolean
Результат boolean

is_vat_exempt() публичный Метод

Is customer VAT exempt?
public is_vat_exempt ( ) : boolean
Результат boolean

set_address_prop() защищенный Метод

Sets a prop for a setter method.
С версии: 2.7.0
protected set_address_prop ( string $prop, string $address = 'billing', mixed $value )
$prop string Name of prop to set.
$address string Name of address to set. billing or shipping.
$value mixed Value of the prop.

set_billing_address() публичный Метод

Set billing_address_1.
public set_billing_address ( string $value )
$value string

set_billing_address_1() публичный Метод

Set billing_address_1.
public set_billing_address_1 ( string $value )
$value string

set_billing_address_2() публичный Метод

Set billing_address_2.
public set_billing_address_2 ( string $value )
$value string

set_billing_address_to_base() публичный Метод

Set customer address to match shop base address.
С версии: 2.7.0

set_billing_city() публичный Метод

Set billing_city.
public set_billing_city ( string $value )
$value string

set_billing_company() публичный Метод

Set billing_company.
public set_billing_company ( string $value )
$value string

set_billing_country() публичный Метод

Set billing_country.
public set_billing_country ( string $value )
$value string

set_billing_email() публичный Метод

Set billing_email.
public set_billing_email ( string $value )
$value string

set_billing_first_name() публичный Метод

Set billing_first_name.
public set_billing_first_name ( string $value )
$value string

set_billing_last_name() публичный Метод

Set billing_last_name.
public set_billing_last_name ( string $value )
$value string

set_billing_location() публичный Метод

Sets all address info at once.
public set_billing_location ( string $country, string $state, string $postcode = '', string $city = '' )
$country string
$state string
$postcode string
$city string

set_billing_phone() публичный Метод

Set billing_phone.
public set_billing_phone ( string $value )
$value string

set_billing_postcode() публичный Метод

Set billing_postcode.
public set_billing_postcode ( string $value )
$value string

set_billing_state() публичный Метод

Set billing_state.
public set_billing_state ( string $value )
$value string

set_calculated_shipping() публичный Метод

Calculated shipping?
public set_calculated_shipping ( boolean $calculated = true )
$calculated boolean

set_date_created() публичный Метод

Set the date this customer was last updated.
С версии: 2.7.0
public set_date_created ( integer $timestamp )
$timestamp integer

set_date_modified() публичный Метод

Set the date this customer was last updated.
С версии: 2.7.0
public set_date_modified ( integer $timestamp )
$timestamp integer

set_email() публичный Метод

Set customer's email.
С версии: 2.7.0
public set_email ( string $value )
$value string

set_first_name() публичный Метод

Set customer's first name.
С версии: 2.7.0
public set_first_name ( string $first_name )
$first_name string

set_is_paying_customer() публичный Метод

Set if the user a paying customer.
С версии: 2.7.0
public set_is_paying_customer ( boolean $is_paying_customer )
$is_paying_customer boolean

set_is_vat_exempt() публичный Метод

Set if customer has tax exemption.
public set_is_vat_exempt ( boolean $is_vat_exempt )
$is_vat_exempt boolean

set_last_name() публичный Метод

Set customer's last name.
С версии: 2.7.0
public set_last_name ( string $last_name )
$last_name string

set_password() публичный Метод

Set customer's password.
С версии: 2.7.0
public set_password ( string $password )
$password string

set_role() публичный Метод

Set customer's user role(s).
С версии: 2.7.0
public set_role ( mixed $role )
$role mixed

set_shipping_address() публичный Метод

Set shipping_address_1.
public set_shipping_address ( string $value )
$value string

set_shipping_address_1() публичный Метод

Set shipping_address_1.
public set_shipping_address_1 ( string $value )
$value string

set_shipping_address_2() публичный Метод

Set shipping_address_2.
public set_shipping_address_2 ( string $value )
$value string

set_shipping_address_to_base() публичный Метод

Set customer shipping address to base address.
С версии: 2.7.0

set_shipping_city() публичный Метод

Set shipping_city.
public set_shipping_city ( string $value )
$value string

set_shipping_company() публичный Метод

Set shipping_company.
public set_shipping_company ( string $value )
$value string

set_shipping_country() публичный Метод

Set shipping_country.
public set_shipping_country ( string $value )
$value string

set_shipping_first_name() публичный Метод

Set shipping_first_name.
public set_shipping_first_name ( string $value )
$value string

set_shipping_last_name() публичный Метод

Set shipping_last_name.
public set_shipping_last_name ( string $value )
$value string

set_shipping_location() публичный Метод

Sets all shipping info at once.
public set_shipping_location ( string $country, string $state = '', string $postcode = '', string $city = '' )
$country string
$state string
$postcode string
$city string

set_shipping_postcode() публичный Метод

Set shipping_postcode.
public set_shipping_postcode ( string $value )
$value string

set_shipping_state() публичный Метод

Set shipping_state.
public set_shipping_state ( string $value )
$value string

set_username() публичный Метод

Set customer's username.
С версии: 2.7.0
public set_username ( string $username )
$username string

Описание свойств

$calculated_shipping защищенное свойство

Stores if user has calculated shipping in this session.
protected string $calculated_shipping
Результат string

$data защищенное свойство

Stores customer data.
protected array $data
Результат array

$is_vat_exempt защищенное свойство

Stores if user is VAT exempt for this session.
protected string $is_vat_exempt
Результат string

$password защищенное свойство

Stores a password if this needs to be changed. Write-only and hidden from _data.
protected string $password
Результат string