PluginProbe
ElasticPress / 4.7.0
ElasticPress v4.7.0
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / includes / classes / Feature / WooCommerce / WooCommerce.php

WooCommerce.php in ElasticPress 4.7.0, at includes/classes/Feature/WooCommerce/WooCommerce.php

652 lines 22.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ElasticPress WooCommerce feature
4 *
5 * @since 2.1
6 * @package elasticpress
7 */
8
9 namespace ElasticPress\Feature\WooCommerce;
10
11 use ElasticPress\Feature;
12 use ElasticPress\FeatureRequirementsStatus;
13 use ElasticPress\Indexables;
14 use ElasticPress\IndexHelper;
15 use ElasticPress\Utils;
16
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit; // Exit if accessed directly.
19 }
20
21 /**
22 * WooCommerce feature class
23 */
24 class WooCommerce extends Feature {
25 /**
26 * If enabled, receive the OrdersAutosuggest object instance
27 *
28 * @since 4.7.0
29 * @var null|OrdersAutosuggest
30 */
31 public $orders_autosuggest = null;
32
33 /**
34 * Receive the Products object instance
35 *
36 * @since 4.7.0
37 * @var null|Products
38 */
39 public $products = null;
40
41 /**
42 * Receive the Orders object instance
43 *
44 * @since 4.5.0
45 * @var null|Orders
46 */
47 public $orders = null;
48
49 /**
50 * Initialize feature setting it's config
51 *
52 * @since 3.0
53 */
54 public function __construct() {
55 $this->slug = 'woocommerce';
56
57 $this->title = esc_html__( 'WooCommerce', 'elasticpress' );
58
59 $this->summary = __( "With ElasticPress, filtering WooCommerce product results is fast and easy. Your customers can find and buy exactly what they're looking for, even if you have a large or complex product catalog.", 'elasticpress' );
60
61 $this->docs_url = __( 'https://elasticpress.zendesk.com/hc/en-us/articles/360050447492-Configuring-ElasticPress-via-the-Plugin-Dashboard#woocommerce', 'elasticpress' );
62
63 $this->requires_install_reindex = true;
64
65 $this->setting_requires_install_reindex = 'orders';
66
67 $this->available_during_installation = true;
68
69 $this->default_settings = [
70 'orders' => '0',
71 ];
72
73 $this->orders = new Orders( $this );
74 $this->products = new Products( $this );
75 $this->orders_autosuggest = new OrdersAutosuggest();
76
77 parent::__construct();
78 }
79
80 /**
81 * Setup all feature filters
82 *
83 * @since 2.1
84 */
85 public function setup() {
86 if ( ! function_exists( 'WC' ) ) {
87 return;
88 }
89
90 $this->products->setup();
91 $this->orders->setup();
92
93 add_filter( 'ep_integrate_search_queries', [ $this, 'disallow_coupons' ], 10, 2 );
94
95 // These hooks are deprecated and will be removed in an upcoming major version of ElasticPress
96 add_filter( 'woocommerce_layered_nav_query_post_ids', [ $this, 'convert_post_object_to_id' ], 10, 4 );
97 add_filter( 'woocommerce_unfiltered_product_ids', [ $this, 'convert_post_object_to_id' ], 10, 4 );
98 add_action( 'ep_wp_query_search_cached_posts', [ $this, 'disallow_duplicated_query' ], 10, 2 );
99
100 // Orders Autosuggest feature.
101 if ( $this->is_orders_autosuggest_enabled() ) {
102 $this->orders_autosuggest->setup();
103 }
104 }
105
106 /**
107 * Given a WP_Query object, return its search term (if any)
108 *
109 * This method also accounts for the `'search'` parameter used by
110 * WooCommerce, in addition to the regular `'s'` parameter.
111 *
112 * @param \WP_Query $query The WP_Query object
113 * @return string
114 */
115 public function get_search_term( \WP_Query $query ) : string {
116 $search = $query->get( 'search' );
117 return ( ! empty( $search ) ) ? $search : $query->get( 's', '' );
118 }
119
120 /**
121 * Make search coupons don't go through ES
122 *
123 * @param bool $enabled Coupons enabled or not
124 * @param WP_Query $query WP Query
125 * @since 4.7.0
126 * @return bool
127 */
128 public function disallow_coupons( $enabled, $query ) {
129 if ( is_admin() ) {
130 return $enabled;
131 }
132
133 if ( 'shop_coupon' === $query->get( 'post_type' ) && empty( $query->query_vars['ep_integrate'] ) ) {
134 return false;
135 }
136
137 return $enabled;
138 }
139
140 /**
141 * Output feature box long
142 *
143 * @since 2.1
144 */
145 public function output_feature_box_long() {
146 ?>
147 <p><?php esc_html_e( 'Most caching and performance tools can’t keep up with the nearly infinite ways your visitors might filter or navigate your products. No matter how many products, filters, or customers you have, ElasticPress will keep your online store performing quickly. If used in combination with the Protected Content feature, ElasticPress will also accelerate order searches and back end product management.', 'elasticpress' ); ?></p>
148 <?php
149 }
150
151 /**
152 * Dashboard WooCommerce settings
153 *
154 * @since 4.5.0
155 */
156 public function output_feature_box_settings() {
157 $available = $this->is_orders_autosuggest_available();
158 $enabled = $this->is_orders_autosuggest_enabled();
159 ?>
160 <div class="field">
161 <div class="field-name status"><?php esc_html_e( 'Orders Autosuggest', 'elasticpress' ); ?></div>
162 <div class="input-wrap">
163 <label><input name="settings[orders]" type="radio" <?php checked( $enabled ); ?> <?php disabled( $available, false, true ); ?> value="1"><?php echo wp_kses_post( __( 'Enabled', 'elasticpress' ) ); ?></label><br>
164 <label><input name="settings[orders]" type="radio" <?php checked( ! $enabled ); ?> <?php disabled( $available, false, true ); ?> value="0"><?php echo wp_kses_post( __( 'Disabled', 'elasticpress' ) ); ?></label>
165 <p class="field-description">
166 <?php
167 $epio_autosuggest_kb_link = 'https://elasticpress.zendesk.com/hc/en-us/articles/13374461690381-Configuring-ElasticPress-io-Order-Autosuggest';
168
169 $message = ( $available ) ?
170 /* translators: 1: <a> tag (ElasticPress.io); 2. </a>; 3: <a> tag (KB article); 4. </a>; */
171 __( 'You are directly connected to %1$sElasticPress.io%2$s! Enable Orders Autosuggest to enhance Dashboard results and quickly find WooCommerce Orders. %3$sLearn More%4$s.', 'elasticpress' ) :
172 /* translators: 1: <a> tag (ElasticPress.io); 2. </a>; 3: <a> tag (KB article); 4. </a>; */
173 __( 'Due to the sensitive nature of orders, this autosuggest feature is available only to %1$sElasticPress.io%2$s customers. %3$sLearn More%4$s.', 'elasticpress' );
174
175 printf(
176 wp_kses( $message, 'ep-html' ),
177 '<a href="https://elasticpress.io/" target="_blank">',
178 '</a>',
179 '<a href="' . esc_url( $epio_autosuggest_kb_link ) . '" target="_blank">',
180 '</a>'
181 );
182 ?>
183 </p>
184 </div>
185 </div>
186 <?php
187 }
188
189 /**
190 * Determine WC feature reqs status
191 *
192 * @since 2.2
193 * @return EP_Feature_Requirements_Status
194 */
195 public function requirements_status() {
196 $status = new FeatureRequirementsStatus( 0 );
197
198 if ( ! class_exists( 'WooCommerce' ) ) {
199 $status->code = 2;
200 $status->message = esc_html__( 'WooCommerce not installed.', 'elasticpress' );
201 }
202
203 return $status;
204 }
205
206 /**
207 * Determines whether or not ES should be integrating with the provided query
208 *
209 * @param \WP_Query $query Query we might integrate with
210 *
211 * @return bool
212 */
213 public function should_integrate_with_query( $query ) {
214 // Lets make sure this doesn't interfere with the CLI
215 if ( defined( 'WP_CLI' ) && WP_CLI ) {
216 return false;
217 }
218
219 if ( defined( 'WC_API_REQUEST' ) && WC_API_REQUEST ) {
220 return false;
221 }
222
223 if ( isset( $query->query_vars['ep_integrate'] ) && ! filter_var( $query->query_vars['ep_integrate'], FILTER_VALIDATE_BOOLEAN ) ) {
224 return false;
225 }
226
227 /**
228 * Filter to skip WP Query integration
229 *
230 * @hook ep_skip_query_integration
231 * @param {bool} $skip True to skip
232 * @param {WP_Query} $query WP Query to evaluate
233 * @return {bool} New skip value
234 */
235 if ( apply_filters( 'ep_skip_query_integration', false, $query ) ) {
236 return false;
237 }
238
239 if ( ! Utils\is_integrated_request( $this->slug ) ) {
240 return false;
241 }
242
243 /**
244 * Do nothing for single product queries
245 */
246 $product_name = $query->get( 'product', false );
247 if ( ! empty( $product_name ) || $query->is_single() ) {
248 return false;
249 }
250
251 /**
252 * ElasticPress does not yet support post_parent queries
253 */
254 $post_parent = $query->get( 'post_parent', false );
255 if ( ! empty( $post_parent ) ) {
256 return false;
257 }
258
259 /**
260 * If this is just a preview, let's not use Elasticsearch.
261 */
262 if ( $query->get( 'preview', false ) ) {
263 return false;
264 }
265
266 return true;
267 }
268
269 /**
270 * Whether orders autosuggest is available or not
271 *
272 * @since 4.5.0
273 * @return boolean
274 */
275 public function is_orders_autosuggest_available() : bool {
276 /**
277 * Whether the autosuggest feature is available for non
278 * ElasticPress.io customers.
279 *
280 * @since 4.5.0
281 * @hook ep_woocommerce_orders_autosuggest_available
282 * @param {boolean} $available Whether the feature is available.
283 */
284 return apply_filters( 'ep_woocommerce_orders_autosuggest_available', Utils\is_epio() );
285 }
286
287 /**
288 * Whether orders autosuggest is enabled or not
289 *
290 * @since 4.5.0
291 * @return boolean
292 */
293 public function is_orders_autosuggest_enabled() : bool {
294 return $this->is_orders_autosuggest_available() && '1' === $this->get_setting( 'orders' );
295 }
296
297 /**
298 * DEPRECATED. Translate args to ElasticPress compat format. This is the meat of what the feature does
299 *
300 * @param \WP_Query $query WP Query
301 * @since 2.1
302 */
303 public function translate_args( $query ) {
304 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->translate_args() OR \ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->orders->translate_args()" );
305 $this->products->translate_args( $query );
306 $this->orders->translate_args( $query );
307 }
308
309 /**
310 * DEPRECATED. Fetch the ES related meta mapping for orderby
311 *
312 * @param array $meta_key The meta key to get the mapping for.
313 * @since 2.1
314 * @return string The mapped meta key.
315 */
316 public function get_orderby_meta_mapping( $meta_key ) {
317 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->get_orderby_meta_mapping()" );
318 return $this->products->get_orderby_meta_mapping( $meta_key );
319 }
320
321 /**
322 * DEPRECATED. Remove the author_name from search fields.
323 *
324 * @param array $search_fields Array of search fields.
325 * @since 3.0
326 * @return array
327 */
328 public function remove_author( $search_fields ) {
329 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->remove_author()" );
330 return $this->products->remove_author( $search_fields );
331 }
332
333 /**
334 * DEPRECATED. Index Woocommerce meta
335 *
336 * @param array $meta Existing post meta.
337 * @param array $post Post arguments array.
338 * @since 2.1
339 * @return array
340 */
341 public function whitelist_meta_keys( $meta, $post ) {
342 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->allow_meta_keys() AND/OR \ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->orders->allow_meta_keys()" );
343 return array_unique(
344 array_merge(
345 $this->products->allow_meta_keys( $meta ),
346 $this->orders->allow_meta_keys( $meta )
347 )
348 );
349 }
350
351 /**
352 * DEPRECATED. Make sure all loop shop post ins are IDS. We have to pass post objects here since we override
353 * the fields=>id query for the layered filter nav query
354 *
355 * @param array $posts Post object array.
356 * @since 2.1
357 * @return array
358 */
359 public function convert_post_object_to_id( $posts ) {
360 _doing_it_wrong( __METHOD__, 'This filter was removed from WooCommerce and will be removed from ElasticPress in a future release.', '4.5.0' );
361 return $posts;
362 }
363
364 /**
365 * DEPRECATED. Index Woocommerce taxonomies
366 *
367 * @param array $taxonomies Index taxonomies array.
368 * @param array $post Post properties array.
369 * @since 2.1
370 * @return array
371 */
372 public function whitelist_taxonomies( $taxonomies, $post ) {
373 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->sync_taxonomies()" );
374 return $this->products->sync_taxonomies( $taxonomies );
375 }
376
377 /**
378 * DEPRECATED. Disallow duplicated ES queries on Orders page.
379 *
380 * @since 2.4
381 *
382 * @param array $value Original filter values.
383 * @param WP_Query $query WP_Query
384 *
385 * @return array
386 */
387 public function disallow_duplicated_query( $value, $query ) {
388 _doing_it_wrong( __METHOD__, 'This filter was removed from WooCommerce and will be removed from ElasticPress in a future release.', '4.5.0' );
389
390 return $value;
391 }
392
393 /**
394 * DEPRECATED. Returns the WooCommerce-oriented post types in admin that EP will search
395 *
396 * @since 4.4.0
397 * @return mixed|void
398 */
399 public function get_admin_searchable_post_types() {
400 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->orders->get_admin_searchable_post_types()" );
401 return $this->orders->get_admin_searchable_post_types();
402 }
403
404 /**
405 * DEPRECATED. Make search coupons don't go through ES
406 *
407 * @param bool $enabled Coupons enabled or not
408 * @param WP_Query $query WP Query
409 * @since 2.1
410 * @return bool
411 */
412 public function blacklist_coupons( $enabled, $query ) {
413 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->disallow_coupons()" );
414 return $this->disallow_coupons( $enabled, $query );
415 }
416
417 /**
418 * DEPRECATED. Allow order creations on the front end to get synced
419 *
420 * @since 2.1
421 * @param bool $override Original order perms check value
422 * @param int $post_id Post ID
423 * @return bool
424 */
425 public function bypass_order_permissions_check( $override, $post_id ) {
426 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->orders->price_filter()" );
427 return $this->orders->bypass_order_permissions_check( $override, $post_id );
428 }
429
430 /**
431 * DEPRECATED. Sets woocommerce meta search fields to an empty array if we are integrating the main query with ElasticSearch
432 *
433 * Woocommerce calls this action as part of its own callback on parse_query. We add this filter only if the query
434 * is integrated with ElasticSearch.
435 * If we were to always return array() on this filter, we'd break admin searches when WooCommerce module is activated
436 * without the Protected Content Module
437 *
438 * @param \WP_Query $query Current query
439 */
440 public function maybe_hook_woocommerce_search_fields( $query ) {
441 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->orders->maybe_hook_woocommerce_search_fields()" );
442 return $this->orders->maybe_hook_woocommerce_search_fields( $query );
443 }
444
445 /**
446 * DEPRECATED. Enhance WooCommerce search order by order id, email, phone number, name, etc..
447 * What this function does:
448 * 1. Reverse the woocommerce shop_order_search_custom_fields query
449 * 2. If the search key is integer and it is an Order Id, just query with post__in
450 * 3. If the search key is integer but not an order id ( might be phone number ), use ES to find it
451 *
452 * @param WP_Query $wp WP Query
453 * @since 2.3
454 */
455 public function search_order( $wp ) {
456 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->orders->search_order()" );
457 return $this->orders->search_order( $wp );
458 }
459
460 /**
461 * DEPRECATED. Add order items as a searchable string.
462 *
463 * This mimics how WooCommerce currently does in the order_itemmeta
464 * table. They combine the titles of the products and put them in a
465 * meta field called "Items".
466 *
467 * @since 2.4
468 *
469 * @param array $post_args Post arguments
470 * @param string|int $post_id Post id
471 *
472 * @return array
473 */
474 public function add_order_items_search( $post_args, $post_id ) {
475 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->orders->add_order_items_search()" );
476 return $this->orders->add_order_items_search( $post_args, $post_id );
477 }
478
479 /**
480 * DEPRECATED. Add WooCommerce Product Attributes to EP Facets.
481 *
482 * @param array $taxonomies Taxonomies array
483 * @return array
484 */
485 public function add_product_attributes( $taxonomies = [] ) {
486 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->add_product_attributes()" );
487 return $this->products->add_product_attributes( $taxonomies );
488 }
489
490 /**
491 * DEPRECATED. Add WooCommerce Fields to the Weighting Dashboard.
492 *
493 * @since 3.x
494 *
495 * @param array $fields Current weighting fields.
496 * @param string $post_type Current post type.
497 * @return array New fields.
498 */
499 public function add_product_attributes_to_weighting( $fields, $post_type ) {
500 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->add_product_attributes_to_weighting()" );
501 return $this->products->add_product_attributes_to_weighting( $fields, $post_type );
502 }
503
504 /**
505 * DEPRECATED. Add WooCommerce Fields to the default values of the Weighting Dashboard.
506 *
507 * @since 3.x
508 *
509 * @param array $defaults Default values for the post type.
510 * @param string $post_type Current post type.
511 * @return array
512 */
513 public function add_product_default_post_type_weights( $defaults, $post_type ) {
514 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->add_product_default_post_type_weights()" );
515 return $this->products->add_product_default_post_type_weights( $defaults, $post_type );
516 }
517
518 /**
519 * DEPRECATED. Add WC post type to autosuggest
520 *
521 * @param array $post_types Array of post types (e.g. post, page).
522 * @since 2.6
523 * @return array
524 */
525 public function suggest_wc_add_post_type( $post_types ) {
526 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->suggest_wc_add_post_type()" );
527 return $this->products->suggest_wc_add_post_type( $post_types );
528 }
529
530 /**
531 * DEPRECATED. Modifies main query to allow filtering by price with WooCommerce "Filter by price" widget.
532 *
533 * @param array $args ES args
534 * @param array $query_args WP_Query args
535 * @param WP_Query $query WP_Query object
536 * @since 3.2
537 * @return array
538 */
539 public function price_filter( $args, $query_args, $query ) {
540 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->price_filter()" );
541 return $this->products->price_filter( $args, $query_args, $query );
542 }
543
544 /**
545 * DEPRECATED. Prevent order fields from being removed.
546 *
547 * When Protected Content is enabled, all posts with password have their content removed.
548 * This can't happen for orders, as the order key is added in that field.
549 *
550 * @see https://github.com/10up/ElasticPress/issues/2726
551 *
552 * @since 4.2.0
553 * @param bool $skip Whether the password protected content should have their content, and meta removed
554 * @param array $post_args Post arguments
555 * @return bool
556 */
557 public function keep_order_fields( $skip, $post_args ) {
558 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->orders->keep_order_fields()" );
559 return $this->orders->keep_order_fields( $skip, $post_args );
560 }
561
562 /**
563 * DEPRECATED. Add a new `_variations_skus` meta field to the product to be indexed in Elasticsearch.
564 *
565 * @since 4.2.0
566 * @param array $post_meta Post meta
567 * @param WP_Post $post Post object
568 * @return array
569 */
570 public function add_variations_skus_meta( $post_meta, $post ) {
571 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->add_variations_skus_meta()" );
572 return $this->products->add_variations_skus_meta( $post_meta, $post );
573 }
574
575 /**
576 * DEPRECATED. Integrate ElasticPress with the WooCommerce Admin Product List.
577 *
578 * WooCommerce uses its `WC_Admin_List_Table_Products` class to control that screen. This
579 * function adds all necessary hooks to bypass the default behavior and integrate with ElasticPress.
580 * By default, WC runs a SQL query to get the Product IDs that match the list criteria and passes
581 * that list of IDs to the main WP_Query. This integration changes that process to a single query, run
582 * by ElasticPress.
583 *
584 * @since 4.2.0
585 * @param array $query_vars Query vars.
586 * @return array
587 */
588 public function admin_product_list_request_query( $query_vars ) {
589 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->admin_product_list_request_query()" );
590 return $this->products->admin_product_list_request_query( $query_vars );
591 }
592
593 /**
594 * DEPRECATED. Apply the necessary changes to WP_Query in WooCommerce Admin Product List.
595 *
596 * @param WP_Query $query The WP Query being executed.
597 */
598 public function translate_args_admin_products_list( $query ) {
599 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->price_filter()" );
600 $this->products->translate_args_admin_products_list( $query );
601 }
602
603 /**
604 * DEPRECATED. Depending on the number of products display an admin notice in the custom sort screen for WooCommerce Products
605 *
606 * @since 4.4.0
607 * @param array $notices Current ElasticPress admin notices
608 * @return array
609 */
610 public function maybe_display_notice_about_product_ordering( $notices ) {
611 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->maybe_display_notice_about_product_ordering()" );
612 return $this->products->maybe_display_notice_about_product_ordering( $notices );
613 }
614
615 /**
616 * DEPRECATED. Conditionally resync products after applying a custom order.
617 *
618 * @since 4.4.0
619 * @param int $sorting_id ID of post dragged and dropped
620 * @param array $menu_orders Post IDs and their new menu_order value
621 */
622 public function action_sync_on_woocommerce_sort_single( $sorting_id, $menu_orders ) {
623 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->action_sync_on_woocommerce_sort_single()" );
624 return $this->products->action_sync_on_woocommerce_sort_single( $sorting_id, $menu_orders );
625 }
626
627 /**
628 * DEPRECATED. Add weight by date settings related to WooCommerce
629 *
630 * @since 4.6.0
631 * @param array $settings Current settings.
632 */
633 public function add_weight_settings_search( $settings ) {
634 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->add_weight_settings_search()" );
635 $this->products->add_weight_settings_search( $settings );
636 }
637
638 /**
639 * DEPRECATED. Conditionally disable decaying by date based on WooCommerce Decay settings.
640 *
641 * @since 4.6.0
642 * @param bool $is_decaying_enabled Whether decay by date is enabled or not
643 * @param array $settings Settings
644 * @param array $args WP_Query args
645 * @return bool
646 */
647 public function maybe_disable_decaying( $is_decaying_enabled, $settings, $args ) {
648 _deprecated_function( __METHOD__, '4.7.0', "\ElasticPress\Features::factory()->get_registered_feature( 'woocommerce' )->products->maybe_disable_decaying()" );
649 return $this->products->maybe_disable_decaying( $is_decaying_enabled, $settings, $args );
650 }
651 }
652