c-template-functions.php/#L2039-L2074 * * @param number $product_per_page Products per page. * @return array Products ids. */ private function get_related_products_ids( $product_per_page = 5 ) { global $post; $product = wc_get_product( $post->ID ); $related_products = array_filter( array_map( 'wc_get_product', wc_get_related_products( $product->get_id(), $product_per_page, $product->get_upsell_ids() ) ), 'wc_products_array_filter_visible' ); $related_products = wc_products_array_orderby( $related_products, 'rand', 'desc' ); $related_product_ids = array_map( function( $product ) { return $product->get_id(); }, $related_products ); return $related_product_ids; } }
Fatal error: Uncaught Error: Class 'Automattic\WooCommerce\Blocks\BlockTypes\RelatedProducts' not found in /home/htzanetatos/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php:117 Stack trace: #0 /home/htzanetatos/public_html/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Blocks\BlockTypesController->register_blocks('') #1 /home/htzanetatos/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #2 /home/htzanetatos/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /home/htzanetatos/public_html/wp-settings.php(727): do_action('init') #4 /home/htzanetatos/public_html/wp-config.php(83): require_once('/home/htzanetat...') #5 /home/htzanetatos/public_html/wp-load.php(50): require_once('/home/htzanetat...') #6 /home/htzanetatos/public_html/wp-blog-header.php(13): require_once('/home/htzanetat...') #7 /home/htzanetatos/public_html/index.php(17): require('/home/htzanetat...') #8 {main} thrown in /home/htzanetatos/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php on line 117