WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
How to add Product Description to Category or shop page (29 posts)

  1. mdlsumair
    Member
    Posted 1 year ago #

    Hello,
    Is there a way we can add some text like 20 to 30 words on category or shop page in woo commerce currently its only showing title on category page

    Help some one

    http://wordpress.org/extend/plugins/woocommerce/

  2. mdlsumair
    Member
    Posted 1 year ago #

    I meant to say We need to show product description on category page

  3. ManusH
    Member
    Posted 1 year ago #

    That category page with the products inside is:
    woocommerce >> templates >> content-product.php

    And you can find that only function to show the Title inside this page as:

    <h3><?php the_title(); ?></h3>

    After that line you can add your own lines:

    <br /><?php echo $product->get_sku(); ?>
    <br /><?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>

    These will display the SKU and the short-description of the product.

    Btw, this is just a quick hard-coded method, you can try to add these functions to the hook on that page in your theme's functions.php.

    add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5);

    As it is mentioned in that hooks comments section that the PRICE is already hooked in there.

  4. mdlsumair
    Member
    Posted 1 year ago #

    Okay that works can you tell me how can you show like 20-30 characters and then read more link?

  5. jastos
    Member
    Posted 1 year ago #

    I didn't see this question before I posted a duplicate question. I also need the same solution as mdlsumair. Is there any way we could take advantage of the "Insert More Tag" in the visual editor of the product (Product Short Description)?

    Clients want short description on Shop pages and then more details within the single product pages.

  6. jastos
    Member
    Posted 1 year ago #

    Here is what I came up with:

    content-product.php - This is the shop page and the code below will show the info from the short description box.

    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    		<?php
    			/**
    			 * woocommerce_after_shop_loop_item_title hook
    			 *
    			 * @hooked woocommerce_template_loop_price - 10
    			 */
    			do_action( 'woocommerce_after_shop_loop_item_title' );
    		?>
    <?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
    	<a class="more" href="<?php the_permalink(); ?>">Read More >></a>
    
    	<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>

    short-description.php - This is for the single page view of a product. I switched this to display from the main content area instead of the short description info.

    global $post;
    
    if ( ! $post->post_excerpt ) return;
    ?>
    <div itemprop="description">
    	<?php the_content(); ?>
    </div>

    Hope this helps!

  7. fatz
    Member
    Posted 1 year ago #

    hello,
    I´m having a similar problem.
    I want to show the short description in the checkout between the product title and the quantity. the code I have so far is:

    <?php
    if (sizeof($woocommerce->cart->get_cart())>0) :
    foreach ($woocommerce->cart->get_cart() as $item_id => $values) :
    $_product = $values['data'];
    if ($_product->exists() && $values['quantity']>0) :
    echo '
    <tr class = "' . esc_attr(apply_filters('woocommerce_checkout_table_item_class', 'checkout_table_item', $values, $item_id ) ) . '">
    									<td class="product-name">'.$_product->get_title().$woocommerce->cart->get_item_data( $values ).'</td>
    									<td class="short_description">'.$_product->get_post_data().$woocommerce->post->get_post_excerpt( $values ).'</td>
    
    <td class="product-quantity">'.$values['quantity'].'</td>
    
    <td class="basispreis">'.$_product->get_price().$woocommerce->post->get_post_excerpt( $values ).'</td>
    
    									<td class="product-total">' . apply_filters( 'woocommerce_checkout_item_subtotal', $woocommerce->cart->get_product_subtotal( $_product, $values['quantity'] ), $values, $item_id ) . '</td>
    </tr>';
    endif;
    endforeach;
    endif;
    do_action( 'woocommerce_cart_contents_review_order' );
    			?>

    I would be so thankful for your help!

  8. Kamile
    Member
    Posted 1 year ago #

    Hello,

    I am using WP-Flexishop, and i need to add description to each post category. But under description it says "The description is not prominent by default; however, some themes may show it." and the theme I am using does not display it.
    What can i do for description to be displayed. Please Help! Will be very grateful.

  9. larssonk22
    Member
    Posted 1 year ago #

    @ManusH Thanks for the hardcode method, it works a treat.

    The only problem is I do not know how to style the paragraph tag.

    <div itemprop="description">
    	<p>Box quantity 75</p>
    </div>
  10. larssonk22
    Member
    Posted 1 year ago #

    Also the description is appear under the page title, anyway I can remove this without using display none

    thanks

  11. josaphi
    Member
    Posted 1 year ago #

    Hi, I am trying to do all mentioned above: Have the title, price and a brief excerpt on the list pages, however I would like that info to appear on image hover. Does anyone know the additional steps to add an action to make these items appear on a mouse hover? I'm sure this is the correct template file that I would need to edit...any help would be greatly appreciated!

    Thanks!

  12. forgetfuljames
    Member
    Posted 1 year ago #

    @Fatz : I've coincidentally come across your posts here, on github, and on the phpforum.de while trying to solve the same problem...

    Have you finally figured this out?

  13. fatz
    Member
    Posted 1 year ago #

    @forgetfuljames

    dear James,
    finally I had to contact a php-programmer to find a solution for the product description. But now it´s working very nicely and totally uncomplicated for my customer too. I couldn´t find another solution in the www, but now I´m very happy with that.

    If you like to have the code consider a small donation to me and I will send it to you. you can write me at my mailaddress: ShrifeeDesign(at)gmail.com

    greetings
    Steffi

  14. forgetfuljames
    Member
    Posted 1 year ago #

    @fatz: Thanks. I used

    $productshort_cart = $_product->post->post_excerpt;
    echo $productshort_cart;

    to get what I needed. Wish I could have saved you the hassle :/

  15. fatz
    Member
    Posted 1 year ago #

    @forgetfuljames

    yes, indeed I´m having the same code! ;)

    working very nicely isn´t it?

  16. forgetfuljames
    Member
    Posted 1 year ago #

    @fatz: yes. i ended up using

    echo var_dump( $values );

    to look at the entire $values variable — WC_Product class has a lot to offer. :)

  17. oksanaar
    Member
    Posted 1 year ago #

    Hey guys!

    Is there any way to pull custom attributes for the product, instead of the short description?

    Thank you!

  18. forgetfuljames
    Member
    Posted 1 year ago #

    @oksanaar: This probably should be a new thread, but...

    ...from within the WooCommerce cart contents loop (the $_product variable is then available to you) you can use the get_attributes( 'attribute-slug' ) function to retrieve any product attribute, where 'attribute-slug' is any attribute slug, like so:

    <?php echo $_product->get_attribute( 'attribute-slug' );?>

  19. oksanaar
    Member
    Posted 1 year ago #

    Thanks! I will start a new thread and comment my response there.

  20. dhaval_jani
    Member
    Posted 1 year ago #

    Hi there,

    Can anyone please let me know how can i get the product category along with product name on the cart page?

    This is how I need and modify :

    <tr>
    <th class="product-remove"> </th>
    <th class="product-thumbnail"> </th>
    <th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
    
    ******This is the update that i need on cart page********
    <th class="product-cat"><?php _e( 'Category', 'woocommerce' ); ?></th>
    
    <th class="product-price"><?php _e( 'Price', 'woocommerce' ); ?></th>
    <th class="product-quantity"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
    <th class="product-subtotal"><?php _e( 'Total', 'woocommerce' ); ?></th>
    </tr>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    Thanks a lot

  21. NitashaRohilla
    Member
    Posted 1 year ago #

    Thanks ManusH

    add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5);

    this code is working for me.

  22. liziziv
    Member
    Posted 10 months ago #

    hi
    i am trying to add a short descibtion line or two under the product item-name befor the price line in the shop page
    i am using woocommerce
    i have in my content-product.php this code:

    <?php if($product_page_productname): ?>
        		  <div class="product-name"><a>"><?php the_title(); ?></a></div>
                <?php endif; ?>
    
                <?php if($product_page_price): ?>
                    <?php do_action( 'woocommerce_after_shop_loop_item_title' ); ?>
                <?php endif; ?>
                <?php if($product_page_addtocart): ?>
                    <?php do_action(
     'woocommerce_after_shop_loop_item' ); ?>
                <?php endif; ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    what do i have to do?

  23. damibjrs
    Member
    Posted 10 months ago #

    Hi! That's just what i'm lookin. Only a little question, it is possible to do the same with product attributes? Height and Weight.

    Thanks!

  24. owcv
    Member
    Posted 10 months ago #

    This solution worked for me:
    http://stackoverflow.com/questions/15479712/woocommerce-description-in-products-page

    But isn't this something for the woocommerce options?

  25. krisscross90
    Member
    Posted 9 months ago #

    I managed to do this, so that the product description shows on the category pages, however I now need to remove this functionality but I can't remember how I did this. Would anyone would have any idea how to do this. Here's the test link http://www.test.vbs4u.com/covingdirect/shop/

  26. owcv
    Member
    Posted 9 months ago #

    Search for this in your functions.php:

    add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5);

    and delete it or just edit the excerpts of your products end empty them.

  27. sidebar
    Member
    Posted 9 months ago #

    New here - sorry if this comes off a bit amateur or in the wrong place. I'm trying to add short product descriptions to our shop page in WooCommerce. Our items are loaded with full and short desc. but can NOT find a place to add a short item title to each of item images in a specific category. Here's one of the pages:
    http://sidebarbeverage.com/product-category/6500-series-horizontal/

    Any guidance would be appreciated.

  28. krisscross90
    Member
    Posted 9 months ago #

    Hi owcv,
    Thank you for your reply! I tried checking it but there's nothing like that in my functions.php. I've checked the archive-product.php page also.... Do you know of any other pages where it could be? I feel so stupid that I've forgotten where I've put it!

  29. Kimo74
    Member
    Posted 9 months ago #

    Hello,
    I'm building a website to sell food and wine.
    I'm looking for a tool that allows me to create a list of features that can be displayed beside my products in form of icon.
    For instance, I would like to be able to show the icon "BIO" beside one of my products if that product is a natural or a another icon (something like a medal) if the product has been awarded.
    Is there a plugin can help me?
    Thank you very much!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic