skip to Main Content

My site is https://outlet.ltd/deals. I tried to add a short description of the WooCommerce product to the achieve page grid (under product title) by following links but was not successful. Nothing shows up.

I’m using REHub theme. Could anyone help?

2

Answers


  1. You can do it with woocommerce_after_shop_loop_item_title hook

    add_action('woocommerce_after_shop_loop_item_title','my_product_description');
    
    function my_product_description() {
    
    // get the global product obj
    
        global $product;
    
    // get the global product obj
    
     $description = $product->get_short_description();
    
    echo $description;
    
    }
    
    Login or Signup to reply.
  2. Add this code on your theme functions.php file.

    // define the woocommerce_after_shop_loop_item_title callback 
    function action_woocommerce_after_shop_loop_item_title(  ) { 
        global $product;
        if( is_shop() ):
            echo $product->get_short_description();
        endif;
    }; 
             
    // add the action 
    add_action( 'woocommerce_after_shop_loop_item_title', 'action_woocommerce_after_shop_loop_item_title', 5 );
    

    it works for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search