• Resolved David Wang

    (@blogjunkie)


    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/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter David Wang

    (@blogjunkie)

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

    get_option('woocommerce_product_tabs') == 'false'

    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.

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

    Thread Starter David Wang

    (@blogjunkie)

    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/

    Roy Ho

    (@splashingpixelscom)

    functions.php of your theme folder.

    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.

    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Replace product short description (excerpt) with long description’ is closed to new replies.