<?php 
    echo wkp_check_and_show_alert_for_dependent_plugin('woocommerce', 'woocommerce.php', 'free');

    if(wkp_check_dependent_plugin('woocommerce', 'woocommerce.php')):
        /**
         * check if single product page 
         * and single page
         */
        if( is_cart()  ):
            ?>
            <div>
                <?php
                    $product = wc_get_product( get_the_ID() );
                    $type = $product->get_type();
                    $price = $product->get_price_html();
                ?>
                <div class="site-main">
                    <?php
                    $crosssells = get_post_meta( get_the_ID(), '_crosssell_ids',true);
                    if(count($crosssells) > 0){
                        echo woocommerce_cross_sell_display($limit = count($crosssells), $columns = 3);
                    } 
                    // woocommerce_output_related_products();
                    // add_action('woocommerce_after_single_product_summary', 'show_cross_sell_in_single_product', 30);
                    // function show_cross_sell_in_single_product(){
                        // $crosssells = get_post_meta( get_the_ID(), '_crosssell_ids',true);
                        
                        // echo '<pre>';
                        // var_dump ($crosssells);
                        // echo '</pre>';
                        // if(empty($crosssells)){
                        //     return;
                        // }

                        // $args = array( 
                        //     'post_type' => 'product', 
                        //     'posts_per_page' => -1, 
                        //     'post__in' => $crosssells 
                        //     );
                        // $products = new WP_Query( $args );
                        // if( $products->have_posts() ) : 
                        //     echo '<div class="cross-sells"><h2>Cross-Sells Products</h2>';
                        //     woocommerce_product_loop_start();
                        //     while ( $products->have_posts() ) : $products->the_post();
                        //         echo get_the_ID();
                        //         echo the_title(). '<br>';
                        //         wc_get_template_part( 'content', 'product' );
                        //     endwhile; // end of the loop.
                        //     woocommerce_product_loop_end();
                        //     echo '</div>';
                        // endif;
                        // wp_reset_postdata();
                    // }
                    ?>
                </div>
            </div>
            <?php   
        else:
            echo '<h2 style="border:solid 5px red; padding:30px;">This element only works for WooCommerce Cart Page</h2>';
        endif;
    endif;
?>