diff --git a/includes/wc-product-functions.php b/includes/wc-product-functions.php index d7e8a1e88f8..8ae524bbfa7 100644 --- a/includes/wc-product-functions.php +++ b/includes/wc-product-functions.php @@ -792,7 +792,7 @@ function wc_get_min_max_price_meta_query( $args ) { * Get relateed products. * * @since 2.7.0 - * @param int $product_id Product ID + * @param int $product_id Product ID. * @param int $limit Limit of results. * @param array $exclude_ids Exclude IDs from the results. * @return array @@ -807,7 +807,7 @@ function wc_get_related_products( $product_id, $limit = 5, $exclude_ids = array( $limit = $limit > 0 ? $limit : 5; // We want to query related posts if they are not cached, or we don't have enough. - if ( false === $related_posts || sizeof( $related_posts ) < $limit ) { + if ( false === $related_posts || count( $related_posts ) < $limit ) { // Related products are found from category and tags. if ( apply_filters( 'woocommerce_product_related_posts_relate_by_category', true, $product_id ) ) { $cats_array = wc_get_related_terms( $product_id, 'product_cat' );