phpwordpresswoocommercecode-snippetswoothemes

Woocommerce product description in reports table & stock page


Is there is a visual hook or a way to include the product description under the product name in the table below or even instead of showing the product name only, to show the product name and product description.

https://snipboard.io/1Lw6CE.jpg

also if its possible to achieve the same here in the table of stocks below:

https://snipboard.io/ASBtMG.jpg

I will appreciate the help in here, thank you so much


Solution

  • Please try this code

    function woocommerce_report_update_title_desc_reports($title, $post){
    global $current_screen;
    if( $current_screen->id == 'woocommerce_page_wc-reports' && is_admin() ) :
        if( is_numeric($post) && get_post_type($post) == 'product' ) :
            $product = wc_get_product($post);
            $title .= ' — ' . $product->get_short_description(); //$product->get_description();
        elseif( is_object($post) ) : //Check Is Product
            $title .= ' — ' . $post->get_short_description(); //$product->get_description();
        endif;
    endif; //Endif  
    return $title;  
    }
    
    add_filter('the_title', 'woocommerce_report_update_title_desc_reports', 10, 2);
    add_filter('woocommerce_product_get_name', 'woocommerce_report_update_title_desc_reports', 10, 2);