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.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / legacy / class-wc-legacy-customer.php
woocommerce / includes / legacy Last commit date
api 3 years ago abstract-wc-legacy-order.php 5 years ago abstract-wc-legacy-payment-token.php 5 years ago abstract-wc-legacy-product.php 5 years ago class-wc-legacy-api.php 4 years ago class-wc-legacy-cart.php 5 years ago class-wc-legacy-coupon.php 5 years ago class-wc-legacy-customer.php 5 years ago class-wc-legacy-shipping-zone.php 5 years ago class-wc-legacy-webhook.php 5 years ago
class-wc-legacy-customer.php
287 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 /**
7 * Legacy Customer.
8 *
9 * @version 3.0.0
10 * @package WooCommerce\Classes
11 * @category Class
12 * @author WooThemes
13 */
14 abstract class WC_Legacy_Customer extends WC_Data {
15
16 /**
17 * __isset legacy.
18 * @param mixed $key
19 * @return bool
20 */
21 public function __isset( $key ) {
22 $legacy_keys = array(
23 'id',
24 'country',
25 'state',
26 'postcode',
27 'city',
28 'address_1',
29 'address',
30 'address_2',
31 'shipping_country',
32 'shipping_state',
33 'shipping_postcode',
34 'shipping_city',
35 'shipping_address_1',
36 'shipping_address',
37 'shipping_address_2',
38 'is_vat_exempt',
39 'calculated_shipping',
40 );
41 $key = $this->filter_legacy_key( $key );
42 return in_array( $key, $legacy_keys );
43 }
44
45 /**
46 * __get function.
47 * @param string $key
48 * @return string
49 */
50 public function __get( $key ) {
51 wc_doing_it_wrong( $key, 'Customer properties should not be accessed directly.', '3.0' );
52 $key = $this->filter_legacy_key( $key );
53 if ( in_array( $key, array( 'country', 'state', 'postcode', 'city', 'address_1', 'address', 'address_2' ) ) ) {
54 $key = 'billing_' . $key;
55 }
56 return is_callable( array( $this, "get_{$key}" ) ) ? $this->{"get_{$key}"}() : '';
57 }
58
59 /**
60 * __set function.
61 *
62 * @param string $key
63 * @param mixed $value
64 */
65 public function __set( $key, $value ) {
66 wc_doing_it_wrong( $key, 'Customer properties should not be set directly.', '3.0' );
67 $key = $this->filter_legacy_key( $key );
68
69 if ( is_callable( array( $this, "set_{$key}" ) ) ) {
70 $this->{"set_{$key}"}( $value );
71 }
72 }
73
74 /**
75 * Address and shipping_address are aliased, so we want to get the 'real' key name.
76 * For all other keys, we can just return it.
77 * @since 3.0.0
78 * @param string $key
79 * @return string
80 */
81 private function filter_legacy_key( $key ) {
82 if ( 'address' === $key ) {
83 $key = 'address_1';
84 }
85 if ( 'shipping_address' === $key ) {
86 $key = 'shipping_address_1';
87 }
88
89 return $key;
90 }
91
92 /**
93 * Sets session data for the location.
94 *
95 * @param string $country
96 * @param string $state
97 * @param string $postcode (default: '')
98 * @param string $city (default: '')
99 */
100 public function set_location( $country, $state, $postcode = '', $city = '' ) {
101 $this->set_billing_location( $country, $state, $postcode, $city );
102 $this->set_shipping_location( $country, $state, $postcode, $city );
103 }
104
105 /**
106 * Get default country for a customer.
107 * @return string
108 */
109 public function get_default_country() {
110 wc_deprecated_function( 'WC_Customer::get_default_country', '3.0', 'wc_get_customer_default_location' );
111 $default = wc_get_customer_default_location();
112 return $default['country'];
113 }
114
115 /**
116 * Get default state for a customer.
117 * @return string
118 */
119 public function get_default_state() {
120 wc_deprecated_function( 'WC_Customer::get_default_state', '3.0', 'wc_get_customer_default_location' );
121 $default = wc_get_customer_default_location();
122 return $default['state'];
123 }
124
125 /**
126 * Set customer address to match shop base address.
127 */
128 public function set_to_base() {
129 wc_deprecated_function( 'WC_Customer::set_to_base', '3.0', 'WC_Customer::set_billing_address_to_base' );
130 $this->set_billing_address_to_base();
131 }
132
133 /**
134 * Set customer shipping address to base address.
135 */
136 public function set_shipping_to_base() {
137 wc_deprecated_function( 'WC_Customer::set_shipping_to_base', '3.0', 'WC_Customer::set_shipping_address_to_base' );
138 $this->set_shipping_address_to_base();
139 }
140
141 /**
142 * Calculated shipping.
143 * @param boolean $calculated
144 */
145 public function calculated_shipping( $calculated = true ) {
146 wc_deprecated_function( 'WC_Customer::calculated_shipping', '3.0', 'WC_Customer::set_calculated_shipping' );
147 $this->set_calculated_shipping( $calculated );
148 }
149
150 /**
151 * Set default data for a customer.
152 */
153 public function set_default_data() {
154 wc_deprecated_function( 'WC_Customer::set_default_data', '3.0' );
155 }
156
157 /**
158 * Save data function.
159 */
160 public function save_data() {
161 $this->save();
162 }
163
164 /**
165 * Is the user a paying customer?
166 *
167 * @param int $user_id
168 *
169 * @return bool
170 */
171 function is_paying_customer( $user_id = '' ) {
172 wc_deprecated_function( 'WC_Customer::is_paying_customer', '3.0', 'WC_Customer::get_is_paying_customer' );
173 if ( ! empty( $user_id ) ) {
174 $user_id = get_current_user_id();
175 }
176 return '1' === get_user_meta( $user_id, 'paying_customer', true );
177 }
178
179 /**
180 * Legacy get address.
181 */
182 function get_address() {
183 wc_deprecated_function( 'WC_Customer::get_address', '3.0', 'WC_Customer::get_billing_address_1' );
184 return $this->get_billing_address_1();
185 }
186
187 /**
188 * Legacy get address 2.
189 */
190 function get_address_2() {
191 wc_deprecated_function( 'WC_Customer::get_address_2', '3.0', 'WC_Customer::get_billing_address_2' );
192 return $this->get_billing_address_2();
193 }
194
195 /**
196 * Legacy get country.
197 */
198 function get_country() {
199 wc_deprecated_function( 'WC_Customer::get_country', '3.0', 'WC_Customer::get_billing_country' );
200 return $this->get_billing_country();
201 }
202
203 /**
204 * Legacy get state.
205 */
206 function get_state() {
207 wc_deprecated_function( 'WC_Customer::get_state', '3.0', 'WC_Customer::get_billing_state' );
208 return $this->get_billing_state();
209 }
210
211 /**
212 * Legacy get postcode.
213 */
214 function get_postcode() {
215 wc_deprecated_function( 'WC_Customer::get_postcode', '3.0', 'WC_Customer::get_billing_postcode' );
216 return $this->get_billing_postcode();
217 }
218
219 /**
220 * Legacy get city.
221 */
222 function get_city() {
223 wc_deprecated_function( 'WC_Customer::get_city', '3.0', 'WC_Customer::get_billing_city' );
224 return $this->get_billing_city();
225 }
226
227 /**
228 * Legacy set country.
229 *
230 * @param string $country
231 */
232 function set_country( $country ) {
233 wc_deprecated_function( 'WC_Customer::set_country', '3.0', 'WC_Customer::set_billing_country' );
234 $this->set_billing_country( $country );
235 }
236
237 /**
238 * Legacy set state.
239 *
240 * @param string $state
241 */
242 function set_state( $state ) {
243 wc_deprecated_function( 'WC_Customer::set_state', '3.0', 'WC_Customer::set_billing_state' );
244 $this->set_billing_state( $state );
245 }
246
247 /**
248 * Legacy set postcode.
249 *
250 * @param string $postcode
251 */
252 function set_postcode( $postcode ) {
253 wc_deprecated_function( 'WC_Customer::set_postcode', '3.0', 'WC_Customer::set_billing_postcode' );
254 $this->set_billing_postcode( $postcode );
255 }
256
257 /**
258 * Legacy set city.
259 *
260 * @param string $city
261 */
262 function set_city( $city ) {
263 wc_deprecated_function( 'WC_Customer::set_city', '3.0', 'WC_Customer::set_billing_city' );
264 $this->set_billing_city( $city );
265 }
266
267 /**
268 * Legacy set address.
269 *
270 * @param string $address
271 */
272 function set_address( $address ) {
273 wc_deprecated_function( 'WC_Customer::set_address', '3.0', 'WC_Customer::set_billing_address' );
274 $this->set_billing_address( $address );
275 }
276
277 /**
278 * Legacy set address.
279 *
280 * @param string $address
281 */
282 function set_address_2( $address ) {
283 wc_deprecated_function( 'WC_Customer::set_address_2', '3.0', 'WC_Customer::set_billing_address_2' );
284 $this->set_billing_address_2( $address );
285 }
286 }
287