Site logo

[Resolved] Add simple description.

Home Forums Support [Resolved] Add simple description.

Home Forums Support Add simple description.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2538704
    Jusung

    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.?

    #2538722
    Jusung

    It is kinda settled..

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

    #2538921
    David
    Staff
    Customer Support

    Glad to hear you found a solution

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.