WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Replace product short description (excerpt) with long description (8 posts)

  1. blogjunkie
    Member
    Posted 1 year ago #

    I want to replace the product short description that appears above the Add to Cart button with the long description ( the_content() ). There are 2 steps to this:

    1. Remove the short description (woocommerce_template_single_excerpt)
    2. Add the long description

    I'm having trouble with step #1. Here's the code that I've come up with so far:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Not <pre>. ]

    /** Remove short description if product tabs are not displayed */
    function tf_reorder_product_page() {
    	if ( get_option('woocommerce_product_tabs') == false ) {
    		remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
    	}
    }
    add_action( 'woocommerce_before_main_content', 'tf_reorder_product_page' );
    
    /** Display product description the_content */
    function tf_do_product_desc() {
    	global $woocommerce, $post;
    
    	if ( $post->post_content ) : ?>
    		<div itemprop="description">
    
    			<?php $heading = apply_filters('woocommerce_product_description_heading', __('Product Description', 'woocommerce')); ?>
    
    			<!-- <h2><?php echo $heading; ?></h2> -->
    
    			<?php the_content(); ?>
    
    		</div>
    	<?php endif;
    }
    add_action( 'woocommerce_single_product_summary', 'tf_do_product_desc', 55 );

    Appreciate any ideas or answers. Thanks!

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

  2. blogjunkie
    Member
    Posted 1 year ago #

    Whoops, realized that I made a stupid mistake in my code. Line 3 should be:

    get_option('woocommerce_product_tabs') == 'false'

  3. agruenke
    Member
    Posted 11 months ago #

    this is exactly what i am looking for... where do i post this edited code to make the change to my site? what PHP file do i need to edit? Your help is appreciated.

  4. dcputernut
    Member
    Posted 11 months ago #

    This is marked resolved....is it? like agruenke I want to do the same thing....but not sure what php to put it in

  5. blogjunkie
    Member
    Posted 11 months ago #

    You put the code above in your theme's functions file. What's a functions file?

    Answer here: http://www.binarymoon.co.uk/2007/05/wordpress-tips-and-tricks-functionsphp/

  6. Roy Ho
    Member
    Posted 11 months ago #

    functions.php of your theme folder.

  7. nggarciar
    Member
    Posted 9 months ago #

    Hi:

    i want to remove the short description but not inside the product as you says, I want to delete the short description that appears before entering the product information, you have the little image, the tittle the short description and the button add to cart, can you tell me hoy to delete that? thank you so much.

  8. ehong33234
    Member
    Posted 8 months ago #

    Is your code still valid? I put it into my functions.php and when I click UPDATE, it just goes to a blank white screen.

    I just copy/paste the code you have above below existing functions.php code but before the ?>

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic