Site logo

Archived topic

Add simple description.

2 replies · Started by Jusung on February 19, 2023

Viewing posts 1–3 of 3

I think this is out of scope..
But, I don't know where to ask this question.

I am trying to add simple description on shop page.
/**
* Add short description to WooCommerce product blocks
*/
function add_short_desc_woocommerce_blocks_product_grid_item_html($content, $data, $product) {
$short_description = '

' . $product->get_short_description() . '

';

// This will inject the short description after the first link (assumed: the default product link).
$after_link_pos = strpos($content, "");
$before = substr($content, 0, $after_link_pos + 4);
$after = substr($content, $after_link_pos + 4);

$content = $before . $short_description . $after;

return $content;
}
add_filter('woocommerce_blocks_product_grid_item_html', 'add_short_desc_woocommerce_blocks_product_grid_item_html', 10 , 3);

The code above works on filtered category.
However, on the all product block. this doesn't work.
So, now I can only see the simple description on [on Sales] or Toys button

add_filter('woocommerce_after_shop_loop_item', 'add_short_desc_woocommerce_blocks_product_grid_item_html', 10 , 3);
I also tried this, but doesn't work.

Do you have any idea how I can fix this.?

It is kinda settled..

I just removed all products block
and used filter category and choose all categories to show all products..

Glad to hear you found a solution

This archived topic is closed to new replies.