Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
wp-content
/
plugins
/
woocommerce
/
includes
/
legacy
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php if (!defined('ABSPATH')) { exit; } abstract class WC_Legacy_Customer extends WC_Data { public function __isset($key) { $legacy_keys = array('id', 'country', 'state', 'postcode', 'city', 'address_1', 'address', 'address_2', 'shipping_country', 'shipping_state', 'shipping_postcode', 'shipping_city', 'shipping_address_1', 'shipping_address', 'shipping_address_2', 'is_vat_exempt', 'calculated_shipping'); $key = $this->filter_legacy_key($key); return in_array($key, $legacy_keys); } public function __get($key) { wc_doing_it_wrong($key, 'Customer properties should not be accessed directly.', '3.0'); $key = $this->filter_legacy_key($key); if (in_array($key, array('country', 'state', 'postcode', 'city', 'address_1', 'address', 'address_2'))) { $key = 'billing_' . $key; } return is_callable(array($this, "get_{$key}")) ? $this->{"get_{$key}"}() : ''; } public function __set($key, $value) { wc_doing_it_wrong($key, 'Customer properties should not be set directly.', '3.0'); $key = $this->filter_legacy_key($key); if (is_callable(array($this, "set_{$key}"))) { $this->{"set_{$key}"}($value); } } private function filter_legacy_key($key) { if ('address' === $key) { $key = 'address_1'; } if ('shipping_address' === $key) { $key = 'shipping_address_1'; } return $key; } public function set_location($country, $state, $postcode = '', $city = '') { $this->set_billing_location($country, $state, $postcode, $city); $this->set_shipping_location($country, $state, $postcode, $city); } public function get_default_country() { wc_deprecated_function('WC_Customer::get_default_country', '3.0', 'wc_get_customer_default_location'); $default = wc_get_customer_default_location(); return $default['country']; } public function get_default_state() { wc_deprecated_function('WC_Customer::get_default_state', '3.0', 'wc_get_customer_default_location'); $default = wc_get_customer_default_location(); return $default['state']; } public function set_to_base() { wc_deprecated_function('WC_Customer::set_to_base', '3.0', 'WC_Customer::set_billing_address_to_base'); $this->set_billing_address_to_base(); } public function set_shipping_to_base() { wc_deprecated_function('WC_Customer::set_shipping_to_base', '3.0', 'WC_Customer::set_shipping_address_to_base'); $this->set_shipping_address_to_base(); } public function calculated_shipping($calculated = true) { wc_deprecated_function('WC_Customer::calculated_shipping', '3.0', 'WC_Customer::set_calculated_shipping'); $this->set_calculated_shipping($calculated); } public function set_default_data() { wc_deprecated_function('WC_Customer::set_default_data', '3.0'); } public function save_data() { $this->save(); } function is_paying_customer($user_id = '') { wc_deprecated_function('WC_Customer::is_paying_customer', '3.0', 'WC_Customer::get_is_paying_customer'); if (!empty($user_id)) { $user_id = get_current_user_id(); } return '1' === get_user_meta($user_id, 'paying_customer', true); } function get_address() { wc_deprecated_function('WC_Customer::get_address', '3.0', 'WC_Customer::get_billing_address_1'); return $this->get_billing_address_1(); } function get_address_2() { wc_deprecated_function('WC_Customer::get_address_2', '3.0', 'WC_Customer::get_billing_address_2'); return $this->get_billing_address_2(); } function get_country() { wc_deprecated_function('WC_Customer::get_country', '3.0', 'WC_Customer::get_billing_country'); return $this->get_billing_country(); } function get_state() { wc_deprecated_function('WC_Customer::get_state', '3.0', 'WC_Customer::get_billing_state'); return $this->get_billing_state(); } function get_postcode() { wc_deprecated_function('WC_Customer::get_postcode', '3.0', 'WC_Customer::get_billing_postcode'); return $this->get_billing_postcode(); } function get_city() { wc_deprecated_function('WC_Customer::get_city', '3.0', 'WC_Customer::get_billing_city'); return $this->get_billing_city(); } function set_country($country) { wc_deprecated_function('WC_Customer::set_country', '3.0', 'WC_Customer::set_billing_country'); $this->set_billing_country($country); } function set_state($state) { wc_deprecated_function('WC_Customer::set_state', '3.0', 'WC_Customer::set_billing_state'); $this->set_billing_state($state); } function set_postcode($postcode) { wc_deprecated_function('WC_Customer::set_postcode', '3.0', 'WC_Customer::set_billing_postcode'); $this->set_billing_postcode($postcode); } function set_city($city) { wc_deprecated_function('WC_Customer::set_city', '3.0', 'WC_Customer::set_billing_city'); $this->set_billing_city($city); } function set_address($address) { wc_deprecated_function('WC_Customer::set_address', '3.0', 'WC_Customer::set_billing_address'); $this->set_billing_address($address); } function set_address_2($address) { wc_deprecated_function('WC_Customer::set_address_2', '3.0', 'WC_Customer::set_billing_address_2'); $this->set_billing_address_2($address); } }