'rand', 'order' => 'desc', ); $args = wp_parse_args( $args, $defaults ); // Get visible upsells then sort them at random, then limit result set. $upsells = wc_products_array_orderby( array_filter( array_map( 'wc_get_product', $product->get_upsell_ids() ), 'wc_products_array_filter_visible' ), $args['orderby'], $args['order'] ); $upsells = $limit > 0 ? array_slice( $upsells, 0, $limit ) : $upsells; if( count( $upsells ) === 0 ) { return; } ?>

'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- previously escaped echo ''; echo ''; ?>