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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 / wc-deprecated-functions.php
woocommerce / includes Last commit date
abstracts 1 year ago admin 1 year ago blocks 1 year ago cli 1 year ago customizer 2 years ago data-stores 1 year ago emails 1 year ago export 1 year ago gateways 1 year ago import 1 year ago integrations 2 years ago interfaces 1 year ago legacy 1 year ago libraries 1 year ago log-handlers 1 year ago payment-tokens 5 years ago product-usage 1 year ago queue 4 years ago react-admin 1 year ago rest-api 1 year ago shipping 1 year ago shortcodes 1 year ago theme-support 2 years ago tracks 1 year ago traits 5 years ago walkers 5 years ago wccom-site 1 year ago widgets 1 year ago class-wc-ajax.php 1 year ago class-wc-auth.php 1 year ago class-wc-autoloader.php 1 year ago class-wc-background-emailer.php 5 years ago class-wc-background-updater.php 5 years ago class-wc-brands-brand-settings-manager.php 1 year ago class-wc-brands-coupons.php 1 year ago class-wc-brands.php 1 year ago class-wc-breadcrumb.php 5 years ago class-wc-cache-helper.php 1 year ago class-wc-cart-fees.php 2 years ago class-wc-cart-session.php 1 year ago class-wc-cart-totals.php 1 year ago class-wc-cart.php 1 year ago class-wc-checkout.php 1 year ago class-wc-cli.php 1 year ago class-wc-comments.php 3 years ago class-wc-countries.php 1 year ago class-wc-coupon.php 1 year ago class-wc-customer-download-log.php 5 years ago class-wc-customer-download.php 1 year ago class-wc-customer.php 1 year ago class-wc-data-exception.php 8 years ago class-wc-data-store.php 3 years ago class-wc-datetime.php 4 years ago class-wc-deprecated-action-hooks.php 2 years ago class-wc-deprecated-filter-hooks.php 3 years ago class-wc-discounts.php 1 year ago class-wc-download-handler.php 1 year ago class-wc-emails.php 1 year ago class-wc-embed.php 1 year ago class-wc-form-handler.php 1 year ago class-wc-frontend-scripts.php 1 year ago class-wc-geo-ip.php 1 year ago class-wc-geolite-integration.php 6 years ago class-wc-geolocation.php 1 year ago class-wc-https.php 2 years ago class-wc-install.php 1 year ago class-wc-integrations.php 5 years ago class-wc-log-levels.php 2 years ago class-wc-logger.php 1 year ago class-wc-meta-data.php 4 years ago class-wc-order-factory.php 2 years ago class-wc-order-item-coupon.php 4 years ago class-wc-order-item-fee.php 1 year ago class-wc-order-item-meta.php 4 years ago class-wc-order-item-product.php 1 year ago class-wc-order-item-shipping.php 1 year ago class-wc-order-item-tax.php 4 years ago class-wc-order-item.php 1 year ago class-wc-order-query.php 4 years ago class-wc-order-refund.php 1 year ago class-wc-order.php 1 year ago class-wc-payment-gateways.php 1 year ago class-wc-payment-tokens.php 3 years ago class-wc-post-data.php 1 year ago class-wc-post-types.php 1 year ago class-wc-privacy-background-process.php 1 year ago class-wc-privacy-erasers.php 1 year ago class-wc-privacy-exporters.php 4 years ago class-wc-privacy.php 1 year ago class-wc-product-attribute.php 4 years ago class-wc-product-download.php 2 years ago class-wc-product-external.php 1 year ago class-wc-product-factory.php 1 year ago class-wc-product-grouped.php 1 year ago class-wc-product-query.php 1 year ago class-wc-product-simple.php 1 year ago class-wc-product-variable.php 1 year ago class-wc-product-variation.php 1 year ago class-wc-query.php 1 year ago class-wc-rate-limiter.php 4 years ago class-wc-regenerate-images-request.php 3 years ago class-wc-regenerate-images.php 1 year ago class-wc-register-wp-admin-settings.php 4 years ago class-wc-rest-authentication.php 1 year ago class-wc-rest-exception.php 5 years ago class-wc-session-handler.php 2 years ago class-wc-shipping-rate.php 1 year ago class-wc-shipping-zone.php 5 years ago class-wc-shipping-zones.php 5 years ago class-wc-shipping.php 1 year ago class-wc-shortcodes.php 1 year ago class-wc-structured-data.php 1 year ago class-wc-tax.php 2 years ago class-wc-template-loader.php 2 years ago class-wc-tracker.php 1 year ago class-wc-validation.php 2 years ago class-wc-webhook.php 1 year ago class-woocommerce.php 1 year ago wc-account-functions.php 1 year ago wc-attribute-functions.php 1 year ago wc-brands-functions.php 1 year ago wc-cart-functions.php 1 year ago wc-conditional-functions.php 1 year ago wc-core-functions.php 1 year ago wc-coupon-functions.php 3 years ago wc-deprecated-functions.php 2 years ago wc-formatting-functions.php 1 year ago wc-notice-functions.php 2 years ago wc-order-functions.php 1 year ago wc-order-item-functions.php 3 years ago wc-page-functions.php 1 year ago wc-product-functions.php 1 year ago wc-rest-functions.php 1 year ago wc-stock-functions.php 1 year ago wc-template-functions.php 1 year ago wc-template-hooks.php 1 year ago wc-term-functions.php 1 year ago wc-update-functions.php 1 year ago wc-user-functions.php 1 year ago wc-webhook-functions.php 1 year ago wc-widget-functions.php 5 years ago
wc-deprecated-functions.php
1182 lines
1 <?php
2 /**
3 * Deprecated functions
4 *
5 * Where functions come to die.
6 *
7 * @author Automattic
8 * @category Core
9 * @package WooCommerce\Functions
10 * @version 3.3.0
11 */
12
13 use Automattic\Jetpack\Constants;
14 use Automattic\WooCommerce\Internal\Admin\Logging\Settings;
15 use Automattic\WooCommerce\Utilities\LoggingUtil;
16
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 /**
22 * Runs a deprecated action with notice only if used.
23 *
24 * @since 3.0.0
25 * @param string $tag The name of the action hook.
26 * @param array $args Array of additional function arguments to be passed to do_action().
27 * @param string $version The version of WooCommerce that deprecated the hook.
28 * @param string $replacement The hook that should have been used.
29 * @param string $message A message regarding the change.
30 */
31 function wc_do_deprecated_action( $tag, $args, $version, $replacement = null, $message = null ) {
32 if ( ! has_action( $tag ) ) {
33 return;
34 }
35
36 wc_deprecated_hook( $tag, $version, $replacement, $message );
37 do_action_ref_array( $tag, $args );
38 }
39
40 /**
41 * Wrapper for deprecated functions so we can apply some extra logic.
42 *
43 * @since 3.0.0
44 * @param string $function Function used.
45 * @param string $version Version the message was added in.
46 * @param string $replacement Replacement for the called function.
47 */
48 function wc_deprecated_function( $function, $version, $replacement = null ) {
49 // @codingStandardsIgnoreStart
50 if ( wp_doing_ajax() || WC()->is_rest_api_request() ) {
51 do_action( 'deprecated_function_run', $function, $replacement, $version );
52 $log_string = "The {$function} function is deprecated since version {$version}.";
53 $log_string .= $replacement ? " Replace with {$replacement}." : '';
54 error_log( $log_string );
55 } else {
56 _deprecated_function( $function, $version, $replacement );
57 }
58 // @codingStandardsIgnoreEnd
59 }
60
61 /**
62 * Wrapper for deprecated hook so we can apply some extra logic.
63 *
64 * @since 3.3.0
65 * @param string $hook The hook that was used.
66 * @param string $version The version of WordPress that deprecated the hook.
67 * @param string $replacement The hook that should have been used.
68 * @param string $message A message regarding the change.
69 */
70 function wc_deprecated_hook( $hook, $version, $replacement = null, $message = null ) {
71 // @codingStandardsIgnoreStart
72 if ( wp_doing_ajax() || WC()->is_rest_api_request() ) {
73 do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message );
74
75 $message = empty( $message ) ? '' : ' ' . $message;
76 $log_string = "{$hook} is deprecated since version {$version}";
77 $log_string .= $replacement ? "! Use {$replacement} instead." : ' with no alternative available.';
78
79 error_log( $log_string . $message );
80 } else {
81 _deprecated_hook( $hook, $version, $replacement, $message );
82 }
83 // @codingStandardsIgnoreEnd
84 }
85
86 /**
87 * When catching an exception, this allows us to log it if unexpected.
88 *
89 * @since 3.3.0
90 * @param Exception $exception_object The exception object.
91 * @param string $function The function which threw exception.
92 * @param array $args The args passed to the function.
93 */
94 function wc_caught_exception( $exception_object, $function = '', $args = array() ) {
95 // @codingStandardsIgnoreStart
96 $message = $exception_object->getMessage();
97 $message .= '. Args: ' . print_r( $args, true ) . '.';
98
99 do_action( 'woocommerce_caught_exception', $exception_object, $function, $args );
100 error_log( "Exception caught in {$function}. {$message}." );
101 // @codingStandardsIgnoreEnd
102 }
103
104 /**
105 * Wrapper for _doing_it_wrong().
106 *
107 * @since 3.0.0
108 * @param string $function Function used.
109 * @param string $message Message to log.
110 * @param string $version Version the message was added in.
111 */
112 function wc_doing_it_wrong( $function, $message, $version ) {
113 // @codingStandardsIgnoreStart
114 $message .= ' Backtrace: ' . wp_debug_backtrace_summary();
115
116 if ( wp_doing_ajax() || WC()->is_rest_api_request() ) {
117 do_action( 'doing_it_wrong_run', $function, $message, $version );
118 error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
119 } else {
120 _doing_it_wrong( $function, $message, $version );
121 }
122 // @codingStandardsIgnoreEnd
123 }
124
125 /**
126 * Wrapper for deprecated arguments so we can apply some extra logic.
127 *
128 * @since 3.0.0
129 * @param string $argument
130 * @param string $version
131 * @param string $replacement
132 */
133 function wc_deprecated_argument( $argument, $version, $message = null ) {
134 if ( wp_doing_ajax() || WC()->is_rest_api_request() ) {
135 do_action( 'deprecated_argument_run', $argument, $message, $version );
136 error_log( "The {$argument} argument is deprecated since version {$version}. {$message}" );
137 } else {
138 _deprecated_argument( $argument, $version, $message );
139 }
140 }
141
142 /**
143 * @deprecated 2.1
144 */
145 function woocommerce_show_messages() {
146 wc_deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_notices' );
147 wc_print_notices();
148 }
149
150 /**
151 * @deprecated 2.1
152 */
153 function woocommerce_weekend_area_js() {
154 wc_deprecated_function( 'woocommerce_weekend_area_js', '2.1' );
155 }
156
157 /**
158 * @deprecated 2.1
159 */
160 function woocommerce_tooltip_js() {
161 wc_deprecated_function( 'woocommerce_tooltip_js', '2.1' );
162 }
163
164 /**
165 * @deprecated 2.1
166 */
167 function woocommerce_datepicker_js() {
168 wc_deprecated_function( 'woocommerce_datepicker_js', '2.1' );
169 }
170
171 /**
172 * @deprecated 2.1
173 */
174 function woocommerce_admin_scripts() {
175 wc_deprecated_function( 'woocommerce_admin_scripts', '2.1' );
176 }
177
178 /**
179 * @deprecated 2.1
180 */
181 function woocommerce_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) {
182 wc_deprecated_function( 'woocommerce_create_page', '2.1', 'wc_create_page' );
183 return wc_create_page( $slug, $option, $page_title, $page_content, $post_parent );
184 }
185
186 /**
187 * @deprecated 2.1
188 */
189 function woocommerce_readfile_chunked( $file, $retbytes = true ) {
190 wc_deprecated_function( 'woocommerce_readfile_chunked', '2.1', 'WC_Download_Handler::readfile_chunked()' );
191 return WC_Download_Handler::readfile_chunked( $file );
192 }
193
194 /**
195 * Formal total costs - format to the number of decimal places for the base currency.
196 *
197 * @access public
198 * @param mixed $number
199 * @deprecated 2.1
200 * @return string
201 */
202 function woocommerce_format_total( $number ) {
203 wc_deprecated_function( __FUNCTION__, '2.1', 'wc_format_decimal()' );
204 return wc_format_decimal( $number, wc_get_price_decimals(), false );
205 }
206
207 /**
208 * Get product name with extra details such as SKU price and attributes. Used within admin.
209 *
210 * @access public
211 * @param WC_Product $product
212 * @deprecated 2.1
213 * @return string
214 */
215 function woocommerce_get_formatted_product_name( $product ) {
216 wc_deprecated_function( __FUNCTION__, '2.1', 'WC_Product::get_formatted_name()' );
217 return $product->get_formatted_name();
218 }
219
220 /**
221 * Handle IPN requests for the legacy paypal gateway by calling gateways manually if needed.
222 *
223 * @access public
224 */
225 function woocommerce_legacy_paypal_ipn() {
226 if ( ! empty( $_GET['paypalListener'] ) && 'paypal_standard_IPN' === $_GET['paypalListener'] ) {
227 WC()->payment_gateways();
228 do_action( 'woocommerce_api_wc_gateway_paypal' );
229 }
230 }
231 add_action( 'init', 'woocommerce_legacy_paypal_ipn' );
232
233 /**
234 * @deprecated 3.0
235 */
236 function get_product( $the_product = false, $args = array() ) {
237 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_product' );
238 return wc_get_product( $the_product, $args );
239 }
240
241 /**
242 * @deprecated 3.0
243 */
244 function woocommerce_protected_product_add_to_cart( $passed, $product_id ) {
245 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_protected_product_add_to_cart' );
246 return wc_protected_product_add_to_cart( $passed, $product_id );
247 }
248
249 /**
250 * @deprecated 3.0
251 */
252 function woocommerce_empty_cart() {
253 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_empty_cart' );
254 wc_empty_cart();
255 }
256
257 /**
258 * @deprecated 3.0
259 */
260 function woocommerce_load_persistent_cart( $user_login, $user = 0 ) {
261 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_load_persistent_cart' );
262 return wc_load_persistent_cart( $user_login, $user );
263 }
264
265 /**
266 * @deprecated 3.0
267 */
268 function woocommerce_add_to_cart_message( $product_id ) {
269 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_to_cart_message' );
270 wc_add_to_cart_message( $product_id );
271 }
272
273 /**
274 * @deprecated 3.0
275 */
276 function woocommerce_clear_cart_after_payment() {
277 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_clear_cart_after_payment' );
278 wc_clear_cart_after_payment();
279 }
280
281 /**
282 * @deprecated 3.0
283 */
284 function woocommerce_cart_totals_subtotal_html() {
285 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_subtotal_html' );
286 wc_cart_totals_subtotal_html();
287 }
288
289 /**
290 * @deprecated 3.0
291 */
292 function woocommerce_cart_totals_shipping_html() {
293 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_shipping_html' );
294 wc_cart_totals_shipping_html();
295 }
296
297 /**
298 * @deprecated 3.0
299 */
300 function woocommerce_cart_totals_coupon_html( $coupon ) {
301 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_coupon_html' );
302 wc_cart_totals_coupon_html( $coupon );
303 }
304
305 /**
306 * @deprecated 3.0
307 */
308 function woocommerce_cart_totals_order_total_html() {
309 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_order_total_html' );
310 wc_cart_totals_order_total_html();
311 }
312
313 /**
314 * @deprecated 3.0
315 */
316 function woocommerce_cart_totals_fee_html( $fee ) {
317 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_fee_html' );
318 wc_cart_totals_fee_html( $fee );
319 }
320
321 /**
322 * @deprecated 3.0
323 */
324 function woocommerce_cart_totals_shipping_method_label( $method ) {
325 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cart_totals_shipping_method_label' );
326 return wc_cart_totals_shipping_method_label( $method );
327 }
328
329 /**
330 * @deprecated 3.0
331 */
332 function woocommerce_get_template_part( $slug, $name = '' ) {
333 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_template_part' );
334 wc_get_template_part( $slug, $name );
335 }
336
337 /**
338 * @deprecated 3.0
339 */
340 function woocommerce_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
341 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_template' );
342 wc_get_template( $template_name, $args, $template_path, $default_path );
343 }
344
345 /**
346 * @deprecated 3.0
347 */
348 function woocommerce_locate_template( $template_name, $template_path = '', $default_path = '' ) {
349 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_locate_template' );
350 return wc_locate_template( $template_name, $template_path, $default_path );
351 }
352
353 /**
354 * @deprecated 3.0
355 */
356 function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) {
357 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_mail' );
358 wc_mail( $to, $subject, $message, $headers, $attachments );
359 }
360
361 /**
362 * @deprecated 3.0
363 */
364 function woocommerce_disable_admin_bar( $show_admin_bar ) {
365 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_disable_admin_bar' );
366 return wc_disable_admin_bar( $show_admin_bar );
367 }
368
369 /**
370 * @deprecated 3.0
371 */
372 function woocommerce_create_new_customer( $email, $username = '', $password = '' ) {
373 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_create_new_customer' );
374 return wc_create_new_customer( $email, $username, $password );
375 }
376
377 /**
378 * @deprecated 3.0
379 */
380 function woocommerce_set_customer_auth_cookie( $customer_id ) {
381 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_set_customer_auth_cookie' );
382 wc_set_customer_auth_cookie( $customer_id );
383 }
384
385 /**
386 * @deprecated 3.0
387 */
388 function woocommerce_update_new_customer_past_orders( $customer_id ) {
389 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_update_new_customer_past_orders' );
390 return wc_update_new_customer_past_orders( $customer_id );
391 }
392
393 /**
394 * @deprecated 3.0
395 */
396 function woocommerce_paying_customer( $order_id ) {
397 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_paying_customer' );
398 wc_paying_customer( $order_id );
399 }
400
401 /**
402 * @deprecated 3.0
403 */
404 function woocommerce_customer_bought_product( $customer_email, $user_id, $product_id ) {
405 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_customer_bought_product' );
406 return wc_customer_bought_product( $customer_email, $user_id, $product_id );
407 }
408
409 /**
410 * @deprecated 3.0
411 */
412 function woocommerce_customer_has_capability( $allcaps, $caps, $args ) {
413 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_customer_has_capability' );
414 return wc_customer_has_capability( $allcaps, $caps, $args );
415 }
416
417 /**
418 * @deprecated 3.0
419 */
420 function woocommerce_sanitize_taxonomy_name( $taxonomy ) {
421 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_sanitize_taxonomy_name' );
422 return wc_sanitize_taxonomy_name( $taxonomy );
423 }
424
425 /**
426 * @deprecated 3.0
427 */
428 function woocommerce_get_filename_from_url( $file_url ) {
429 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_filename_from_url' );
430 return wc_get_filename_from_url( $file_url );
431 }
432
433 /**
434 * @deprecated 3.0
435 */
436 function woocommerce_get_dimension( $dim, $to_unit ) {
437 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_dimension' );
438 return wc_get_dimension( $dim, $to_unit );
439 }
440
441 /**
442 * @deprecated 3.0
443 */
444 function woocommerce_get_weight( $weight, $to_unit ) {
445 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_weight' );
446 return wc_get_weight( $weight, $to_unit );
447 }
448
449 /**
450 * @deprecated 3.0
451 */
452 function woocommerce_trim_zeros( $price ) {
453 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_trim_zeros' );
454 return wc_trim_zeros( $price );
455 }
456
457 /**
458 * @deprecated 3.0
459 */
460 function woocommerce_round_tax_total( $tax ) {
461 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_round_tax_total' );
462 return wc_round_tax_total( $tax );
463 }
464
465 /**
466 * @deprecated 3.0
467 */
468 function woocommerce_format_decimal( $number, $dp = false, $trim_zeros = false ) {
469 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_format_decimal' );
470 return wc_format_decimal( $number, $dp, $trim_zeros );
471 }
472
473 /**
474 * @deprecated 3.0
475 */
476 function woocommerce_clean( $var ) {
477 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_clean' );
478 return wc_clean( $var );
479 }
480
481 /**
482 * @deprecated 3.0
483 */
484 function woocommerce_array_overlay( $a1, $a2 ) {
485 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_array_overlay' );
486 return wc_array_overlay( $a1, $a2 );
487 }
488
489 /**
490 * @deprecated 3.0
491 */
492 function woocommerce_price( $price, $args = array() ) {
493 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_price' );
494 return wc_price( $price, $args );
495 }
496
497 /**
498 * @deprecated 3.0
499 */
500 function woocommerce_let_to_num( $size ) {
501 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_let_to_num' );
502 return wc_let_to_num( $size );
503 }
504
505 /**
506 * @deprecated 3.0
507 */
508 function woocommerce_date_format() {
509 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_date_format' );
510 return wc_date_format();
511 }
512
513 /**
514 * @deprecated 3.0
515 */
516 function woocommerce_time_format() {
517 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_time_format' );
518 return wc_time_format();
519 }
520
521 /**
522 * @deprecated 3.0
523 */
524 function woocommerce_timezone_string() {
525 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_timezone_string' );
526 return wc_timezone_string();
527 }
528
529 if ( ! function_exists( 'woocommerce_rgb_from_hex' ) ) {
530 /**
531 * @deprecated 3.0
532 */
533 function woocommerce_rgb_from_hex( $color ) {
534 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_rgb_from_hex' );
535 return wc_rgb_from_hex( $color );
536 }
537 }
538
539 if ( ! function_exists( 'woocommerce_hex_darker' ) ) {
540 /**
541 * @deprecated 3.0
542 */
543 function woocommerce_hex_darker( $color, $factor = 30 ) {
544 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_hex_darker' );
545 return wc_hex_darker( $color, $factor );
546 }
547 }
548
549 if ( ! function_exists( 'woocommerce_hex_lighter' ) ) {
550 /**
551 * @deprecated 3.0
552 */
553 function woocommerce_hex_lighter( $color, $factor = 30 ) {
554 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_hex_lighter' );
555 return wc_hex_lighter( $color, $factor );
556 }
557 }
558
559 if ( ! function_exists( 'woocommerce_light_or_dark' ) ) {
560 /**
561 * @deprecated 3.0
562 */
563 function woocommerce_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
564 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_light_or_dark' );
565 return wc_light_or_dark( $color, $dark, $light );
566 }
567 }
568
569 if ( ! function_exists( 'woocommerce_format_hex' ) ) {
570 /**
571 * @deprecated 3.0
572 */
573 function woocommerce_format_hex( $hex ) {
574 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_format_hex' );
575 return wc_format_hex( $hex );
576 }
577 }
578
579 /**
580 * @deprecated 3.0
581 */
582 function woocommerce_get_order_id_by_order_key( $order_key ) {
583 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_order_id_by_order_key' );
584 return wc_get_order_id_by_order_key( $order_key );
585 }
586
587 /**
588 * @deprecated 3.0
589 */
590 function woocommerce_downloadable_file_permission( $download_id, $product_id, $order ) {
591 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_downloadable_file_permission' );
592 return wc_downloadable_file_permission( $download_id, $product_id, $order );
593 }
594
595 /**
596 * @deprecated 3.0
597 */
598 function woocommerce_downloadable_product_permissions( $order_id ) {
599 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_downloadable_product_permissions' );
600 wc_downloadable_product_permissions( $order_id );
601 }
602
603 /**
604 * @deprecated 3.0
605 */
606 function woocommerce_add_order_item( $order_id, $item ) {
607 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_order_item' );
608 return wc_add_order_item( $order_id, $item );
609 }
610
611 /**
612 * @deprecated 3.0
613 */
614 function woocommerce_delete_order_item( $item_id ) {
615 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_delete_order_item' );
616 return wc_delete_order_item( $item_id );
617 }
618
619 /**
620 * @deprecated 3.0
621 */
622 function woocommerce_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value = '' ) {
623 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_update_order_item_meta' );
624 return wc_update_order_item_meta( $item_id, $meta_key, $meta_value, $prev_value );
625 }
626
627 /**
628 * @deprecated 3.0
629 */
630 function woocommerce_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) {
631 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_order_item_meta' );
632 return wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique );
633 }
634
635 /**
636 * @deprecated 3.0
637 */
638 function woocommerce_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $delete_all = false ) {
639 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_delete_order_item_meta' );
640 return wc_delete_order_item_meta( $item_id, $meta_key, $meta_value, $delete_all );
641 }
642
643 /**
644 * @deprecated 3.0
645 */
646 function woocommerce_get_order_item_meta( $item_id, $key, $single = true ) {
647 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_order_item_meta' );
648 return wc_get_order_item_meta( $item_id, $key, $single );
649 }
650
651 /**
652 * @deprecated 3.0
653 */
654 function woocommerce_cancel_unpaid_orders() {
655 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_cancel_unpaid_orders' );
656 wc_cancel_unpaid_orders();
657 }
658
659 /**
660 * @deprecated 3.0
661 */
662 function woocommerce_processing_order_count() {
663 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_processing_order_count' );
664 return wc_processing_order_count();
665 }
666
667 /**
668 * @deprecated 3.0
669 */
670 function woocommerce_get_page_id( $page ) {
671 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_page_id' );
672 return wc_get_page_id( $page );
673 }
674
675 /**
676 * @deprecated 3.0
677 */
678 function woocommerce_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
679 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_endpoint_url' );
680 return wc_get_endpoint_url( $endpoint, $value, $permalink );
681 }
682
683 /**
684 * @deprecated 3.0
685 */
686 function woocommerce_lostpassword_url( $url ) {
687 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_lostpassword_url' );
688 return wc_lostpassword_url( $url );
689 }
690
691 /**
692 * @deprecated 3.0
693 */
694 function woocommerce_customer_edit_account_url() {
695 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_customer_edit_account_url' );
696 return wc_customer_edit_account_url();
697 }
698
699 /**
700 * @deprecated 3.0
701 */
702 function woocommerce_nav_menu_items( $items, $args ) {
703 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_nav_menu_items' );
704 return wc_nav_menu_items( $items );
705 }
706
707 /**
708 * @deprecated 3.0
709 */
710 function woocommerce_nav_menu_item_classes( $menu_items, $args ) {
711 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_nav_menu_item_classes' );
712 return wc_nav_menu_item_classes( $menu_items );
713 }
714
715 /**
716 * @deprecated 3.0
717 */
718 function woocommerce_list_pages( $pages ) {
719 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_list_pages' );
720 return wc_list_pages( $pages );
721 }
722
723 /**
724 * @deprecated 3.0
725 */
726 function woocommerce_product_dropdown_categories( $args = array(), $deprecated_hierarchical = 1, $deprecated_show_uncategorized = 1, $deprecated_orderby = '' ) {
727 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_product_dropdown_categories' );
728 return wc_product_dropdown_categories( $args, $deprecated_hierarchical, $deprecated_show_uncategorized, $deprecated_orderby );
729 }
730
731 /**
732 * @deprecated 3.0
733 */
734 function woocommerce_walk_category_dropdown_tree( $a1 = '', $a2 = '', $a3 = '' ) {
735 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_walk_category_dropdown_tree' );
736 return wc_walk_category_dropdown_tree( $a1, $a2, $a3 );
737 }
738
739 /**
740 * @deprecated 3.0
741 */
742 function woocommerce_taxonomy_metadata_wpdbfix() {
743 wc_deprecated_function( __FUNCTION__, '3.0' );
744 }
745
746 /**
747 * @deprecated 3.0
748 */
749 function wc_taxonomy_metadata_wpdbfix() {
750 wc_deprecated_function( __FUNCTION__, '3.0' );
751 }
752
753 /**
754 * @deprecated 3.0
755 */
756 function woocommerce_order_terms( $the_term, $next_id, $taxonomy, $index = 0, $terms = null ) {
757 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_reorder_terms' );
758 return wc_reorder_terms( $the_term, $next_id, $taxonomy, $index, $terms );
759 }
760
761 /**
762 * @deprecated 3.0
763 */
764 function woocommerce_set_term_order( $term_id, $index, $taxonomy, $recursive = false ) {
765 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_set_term_order' );
766 return wc_set_term_order( $term_id, $index, $taxonomy, $recursive );
767 }
768
769 /**
770 * @deprecated 3.0
771 */
772 function woocommerce_terms_clauses( $clauses, $taxonomies, $args ) {
773 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_terms_clauses' );
774 return wc_terms_clauses( $clauses, $taxonomies, $args );
775 }
776
777 /**
778 * @deprecated 3.0
779 */
780 function _woocommerce_term_recount( $terms, $taxonomy, $callback, $terms_are_term_taxonomy_ids ) {
781 wc_deprecated_function( __FUNCTION__, '3.0', '_wc_term_recount' );
782 return _wc_term_recount( $terms, $taxonomy, $callback, $terms_are_term_taxonomy_ids );
783 }
784
785 /**
786 * @deprecated 3.0
787 */
788 function woocommerce_recount_after_stock_change( $product_id ) {
789 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_recount_after_stock_change' );
790 return wc_recount_after_stock_change( $product_id );
791 }
792
793 /**
794 * @deprecated 3.0
795 */
796 function woocommerce_change_term_counts( $terms, $taxonomies, $args ) {
797 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_change_term_counts' );
798 return wc_change_term_counts( $terms, $taxonomies );
799 }
800
801 /**
802 * @deprecated 3.0
803 */
804 function woocommerce_get_product_ids_on_sale() {
805 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_product_ids_on_sale' );
806 return wc_get_product_ids_on_sale();
807 }
808
809 /**
810 * @deprecated 3.0
811 */
812 function woocommerce_get_featured_product_ids() {
813 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_featured_product_ids' );
814 return wc_get_featured_product_ids();
815 }
816
817 /**
818 * @deprecated 3.0
819 */
820 function woocommerce_get_product_terms( $object_id, $taxonomy, $fields = 'all' ) {
821 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_product_terms' );
822 return wc_get_product_terms( $object_id, $taxonomy, array( 'fields' => $fields ) );
823 }
824
825 /**
826 * @deprecated 3.0
827 */
828 function woocommerce_product_post_type_link( $permalink, $post ) {
829 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_product_post_type_link' );
830 return wc_product_post_type_link( $permalink, $post );
831 }
832
833 /**
834 * @deprecated 3.0
835 */
836 function woocommerce_placeholder_img_src() {
837 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_placeholder_img_src' );
838 return wc_placeholder_img_src();
839 }
840
841 /**
842 * @deprecated 3.0
843 */
844 function woocommerce_placeholder_img( $size = 'woocommerce_thumbnail' ) {
845 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_placeholder_img' );
846 return wc_placeholder_img( $size );
847 }
848
849 /**
850 * @deprecated 3.0
851 */
852 function woocommerce_get_formatted_variation( $variation = '', $flat = false ) {
853 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_formatted_variation' );
854 return wc_get_formatted_variation( $variation, $flat );
855 }
856
857 /**
858 * @deprecated 3.0
859 */
860 function woocommerce_scheduled_sales() {
861 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_scheduled_sales' );
862 return wc_scheduled_sales();
863 }
864
865 /**
866 * @deprecated 3.0
867 */
868 function woocommerce_get_attachment_image_attributes( $attr ) {
869 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_get_attachment_image_attributes' );
870 return wc_get_attachment_image_attributes( $attr );
871 }
872
873 /**
874 * @deprecated 3.0
875 */
876 function woocommerce_prepare_attachment_for_js( $response ) {
877 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_prepare_attachment_for_js' );
878 return wc_prepare_attachment_for_js( $response );
879 }
880
881 /**
882 * @deprecated 3.0
883 */
884 function woocommerce_track_product_view() {
885 wc_deprecated_function( __FUNCTION__, '3.0', 'wc_track_product_view' );
886 return wc_track_product_view();
887 }
888
889 /**
890 * @deprecated 2.3 has no replacement
891 */
892 function woocommerce_compile_less_styles() {
893 wc_deprecated_function( 'woocommerce_compile_less_styles', '2.3' );
894 }
895
896 /**
897 * woocommerce_calc_shipping was an option used to determine if shipping was enabled prior to version 2.6.0. This has since been replaced with wc_shipping_enabled() function and
898 * the woocommerce_ship_to_countries setting.
899 * @deprecated 2.6.0
900 * @return string
901 */
902 function woocommerce_calc_shipping_backwards_compatibility( $value ) {
903 if ( Constants::is_defined( 'WC_UPDATING' ) ) {
904 return $value;
905 }
906 return 'disabled' === get_option( 'woocommerce_ship_to_countries' ) ? 'no' : 'yes';
907 }
908 add_filter( 'pre_option_woocommerce_calc_shipping', 'woocommerce_calc_shipping_backwards_compatibility' );
909
910 /**
911 * @deprecated 3.0.0
912 * @see WC_Structured_Data class
913 *
914 * @return string
915 */
916 function woocommerce_get_product_schema() {
917 wc_deprecated_function( 'woocommerce_get_product_schema', '3.0' );
918
919 global $product;
920
921 $schema = "Product";
922
923 // Downloadable product schema handling
924 if ( $product->is_downloadable() ) {
925 switch ( $product->download_type ) {
926 case 'application' :
927 $schema = "SoftwareApplication";
928 break;
929 case 'music' :
930 $schema = "MusicAlbum";
931 break;
932 default :
933 $schema = "Product";
934 break;
935 }
936 }
937
938 return 'http://schema.org/' . $schema;
939 }
940
941 /**
942 * Save product price.
943 *
944 * This is a private function (internal use ONLY) used until a data manipulation api is built.
945 *
946 * @deprecated 3.0.0
947 * @param int $product_id
948 * @param float $regular_price
949 * @param float $sale_price
950 * @param string $date_from
951 * @param string $date_to
952 */
953 function _wc_save_product_price( $product_id, $regular_price, $sale_price = '', $date_from = '', $date_to = '' ) {
954 wc_doing_it_wrong( '_wc_save_product_price()', 'This function is not for developer use and is deprecated.', '3.0' );
955
956 $product_id = absint( $product_id );
957 $regular_price = wc_format_decimal( $regular_price );
958 $sale_price = '' === $sale_price ? '' : wc_format_decimal( $sale_price );
959 $date_from = wc_clean( $date_from );
960 $date_to = wc_clean( $date_to );
961
962 update_post_meta( $product_id, '_regular_price', $regular_price );
963 update_post_meta( $product_id, '_sale_price', $sale_price );
964
965 // Save Dates
966 update_post_meta( $product_id, '_sale_price_dates_from', $date_from ? strtotime( $date_from ) : '' );
967 update_post_meta( $product_id, '_sale_price_dates_to', $date_to ? strtotime( $date_to ) : '' );
968
969 if ( $date_to && ! $date_from ) {
970 $date_from = strtotime( 'NOW', current_time( 'timestamp' ) );
971 update_post_meta( $product_id, '_sale_price_dates_from', $date_from );
972 }
973
974 // Update price if on sale
975 if ( '' !== $sale_price && '' === $date_to && '' === $date_from ) {
976 update_post_meta( $product_id, '_price', $sale_price );
977 } else {
978 update_post_meta( $product_id, '_price', $regular_price );
979 }
980
981 if ( '' !== $sale_price && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
982 update_post_meta( $product_id, '_price', $sale_price );
983 }
984
985 if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
986 update_post_meta( $product_id, '_price', $regular_price );
987 update_post_meta( $product_id, '_sale_price_dates_from', '' );
988 update_post_meta( $product_id, '_sale_price_dates_to', '' );
989 }
990 }
991
992 /**
993 * Return customer avatar URL.
994 *
995 * @deprecated 3.1.0
996 * @since 2.6.0
997 * @param string $email the customer's email.
998 * @return string the URL to the customer's avatar.
999 */
1000 function wc_get_customer_avatar_url( $email ) {
1001 // Deprecated in favor of WordPress get_avatar_url() function.
1002 wc_deprecated_function( 'wc_get_customer_avatar_url()', '3.1', 'get_avatar_url()' );
1003
1004 return get_avatar_url( $email );
1005 }
1006
1007 /**
1008 * WooCommerce Core Supported Themes.
1009 *
1010 * @deprecated 3.3.0
1011 * @since 2.2
1012 * @return string[]
1013 */
1014 function wc_get_core_supported_themes() {
1015 wc_deprecated_function( 'wc_get_core_supported_themes()', '3.3' );
1016 return array( 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' );
1017 }
1018
1019 /**
1020 * Get min/max price meta query args.
1021 *
1022 * @deprecated 3.6.0
1023 * @since 3.0.0
1024 * @param array $args Min price and max price arguments.
1025 * @return array
1026 */
1027 function wc_get_min_max_price_meta_query( $args ) {
1028 wc_deprecated_function( 'wc_get_min_max_price_meta_query()', '3.6' );
1029
1030 $current_min_price = isset( $args['min_price'] ) ? floatval( $args['min_price'] ) : 0;
1031 $current_max_price = isset( $args['max_price'] ) ? floatval( $args['max_price'] ) : PHP_INT_MAX;
1032
1033 return apply_filters(
1034 'woocommerce_get_min_max_price_meta_query',
1035 array(
1036 'key' => '_price',
1037 'value' => array( $current_min_price, $current_max_price ),
1038 'compare' => 'BETWEEN',
1039 'type' => 'DECIMAL(10,' . wc_get_price_decimals() . ')',
1040 ),
1041 $args
1042 );
1043 }
1044
1045 /**
1046 * When a term is split, ensure meta data maintained.
1047 *
1048 * @deprecated 3.6.0
1049 * @param int $old_term_id Old term ID.
1050 * @param int $new_term_id New term ID.
1051 * @param string $term_taxonomy_id Term taxonomy ID.
1052 * @param string $taxonomy Taxonomy.
1053 */
1054 function wc_taxonomy_metadata_update_content_for_split_terms( $old_term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
1055 wc_deprecated_function( 'wc_taxonomy_metadata_update_content_for_split_terms', '3.6' );
1056 }
1057
1058 /**
1059 * WooCommerce Term Meta API.
1060 *
1061 * WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table.
1062 * This function serves as a wrapper, using the new table if present, or falling back to the WC table.
1063 *
1064 * @deprecated 3.6.0
1065 * @param int $term_id Term ID.
1066 * @param string $meta_key Meta key.
1067 * @param mixed $meta_value Meta value.
1068 * @param string $prev_value Previous value. (default: '').
1069 * @return bool
1070 */
1071 function update_woocommerce_term_meta( $term_id, $meta_key, $meta_value, $prev_value = '' ) {
1072 wc_deprecated_function( 'update_woocommerce_term_meta', '3.6', 'update_term_meta' );
1073 return function_exists( 'update_term_meta' ) ? update_term_meta( $term_id, $meta_key, $meta_value, $prev_value ) : update_metadata( 'woocommerce_term', $term_id, $meta_key, $meta_value, $prev_value );
1074 }
1075
1076 /**
1077 * WooCommerce Term Meta API.
1078 *
1079 * WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table.
1080 * This function serves as a wrapper, using the new table if present, or falling back to the WC table.
1081 *
1082 * @deprecated 3.6.0
1083 * @param int $term_id Term ID.
1084 * @param string $meta_key Meta key.
1085 * @param mixed $meta_value Meta value.
1086 * @param bool $unique Make meta key unique. (default: false).
1087 * @return bool
1088 */
1089 function add_woocommerce_term_meta( $term_id, $meta_key, $meta_value, $unique = false ) {
1090 wc_deprecated_function( 'add_woocommerce_term_meta', '3.6', 'add_term_meta' );
1091 return function_exists( 'add_term_meta' ) ? add_term_meta( $term_id, $meta_key, $meta_value, $unique ) : add_metadata( 'woocommerce_term', $term_id, $meta_key, $meta_value, $unique );
1092 }
1093
1094 /**
1095 * WooCommerce Term Meta API
1096 *
1097 * WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table.
1098 * This function serves as a wrapper, using the new table if present, or falling back to the WC table.
1099 *
1100 * @deprecated 3.6.0
1101 * @param int $term_id Term ID.
1102 * @param string $meta_key Meta key.
1103 * @param mixed $meta_value Meta value (default: '').
1104 * @param bool $deprecated Deprecated param (default: false).
1105 * @return bool
1106 */
1107 function delete_woocommerce_term_meta( $term_id, $meta_key, $meta_value = '', $deprecated = false ) {
1108 wc_deprecated_function( 'delete_woocommerce_term_meta', '3.6', 'delete_term_meta' );
1109 return function_exists( 'delete_term_meta' ) ? delete_term_meta( $term_id, $meta_key, $meta_value ) : delete_metadata( 'woocommerce_term', $term_id, $meta_key, $meta_value );
1110 }
1111
1112 /**
1113 * WooCommerce Term Meta API
1114 *
1115 * WC tables for storing term meta are deprecated from WordPress 4.4 since 4.4 has its own table.
1116 * This function serves as a wrapper, using the new table if present, or falling back to the WC table.
1117 *
1118 * @deprecated 3.6.0
1119 * @param int $term_id Term ID.
1120 * @param string $key Meta key.
1121 * @param bool $single Whether to return a single value. (default: true).
1122 * @return mixed
1123 */
1124 function get_woocommerce_term_meta( $term_id, $key, $single = true ) {
1125 wc_deprecated_function( 'get_woocommerce_term_meta', '3.6', 'get_term_meta' );
1126 return function_exists( 'get_term_meta' ) ? get_term_meta( $term_id, $key, $single ) : get_metadata( 'woocommerce_term', $term_id, $key, $single );
1127 }
1128
1129 /**
1130 * Registers the default log handler.
1131 *
1132 * @deprecated 8.6.0
1133 * @since 3.0
1134 * @param array $handlers Handlers.
1135 * @return array
1136 */
1137 function wc_register_default_log_handler( $handlers = array() ) {
1138 wc_deprecated_function( 'wc_register_default_log_handler', '8.6.0' );
1139
1140 $default_handler = wc_get_container()->get( Settings::class )->get_default_handler();
1141
1142 array_push( $handlers, new $default_handler() );
1143
1144 return $handlers;
1145 }
1146
1147 /**
1148 * Get a log file path.
1149 *
1150 * @deprecated 8.6.0
1151 * @since 2.2
1152 *
1153 * @param string $handle name.
1154 * @return string the log file path.
1155 */
1156 function wc_get_log_file_path( $handle ) {
1157 wc_deprecated_function( 'wc_get_log_file_path', '8.6.0' );
1158
1159 $directory = LoggingUtil::get_log_directory();
1160 $file_id = LoggingUtil::generate_log_file_id( $handle, null, time() );
1161 $hash = LoggingUtil::generate_log_file_hash( $file_id );
1162
1163 return "{$directory}{$file_id}-{$hash}.log";
1164 }
1165
1166 /**
1167 * Get a log file name.
1168 *
1169 * @since 3.3
1170 *
1171 * @param string $handle Name.
1172 * @return string The log file name.
1173 */
1174 function wc_get_log_file_name( $handle ) {
1175 wc_deprecated_function( 'wc_get_log_file_name', '8.6.0' );
1176
1177 $file_id = LoggingUtil::generate_log_file_id( $handle, null, time() );
1178 $hash = LoggingUtil::generate_log_file_hash( $file_id );
1179
1180 return "{$file_id}-{$hash}";
1181 }
1182