diff --git a/includes/data-stores/class-wc-product-data-store-cpt.php b/includes/data-stores/class-wc-product-data-store-cpt.php index 63ab5542535..5be3ce6ebe8 100644 --- a/includes/data-stores/class-wc-product-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-data-store-cpt.php @@ -1543,12 +1543,22 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da return $custom_results; } - $post_types = $include_variations ? array( 'product', 'product_variation' ) : array( 'product' ); - $post_statuses = current_user_can( 'edit_private_products' ) ? array( 'private', 'publish' ) : array( 'publish' ); - $type_where = ''; - $status_where = ''; - $limit_query = ''; - $term = wc_strtolower( $term ); + $post_types = $include_variations ? array( 'product', 'product_variation' ) : array( 'product' ); + $type_where = ''; + $status_where = ''; + $limit_query = ''; + $term = wc_strtolower( $term ); + + /** + * Hook woocommerce_search_products_post_statuses. + * + * @since 3.7.0 + * @param array $post_statuses List of post statuses. + */ + $post_statuses = apply_filters( + 'woocommerce_search_products_post_statuses', + current_user_can( 'edit_private_products' ) ? array( 'private', 'publish' ) : array( 'publish' ) + ); // See if search term contains OR keywords. if ( strstr( $term, ' or ' ) ) {