2
votes

I want reverse description and short description single product pages on woocommerce . I try this tuto : http://www.kriesi.at/support/topic/reverse-description-and-short-description-single-product-pages/ . Short description work but not description .

I use woocommercer version 2.3.7 .

Thank

2
Would be nice if you posted the relevant code in your question.helgatheviking

2 Answers

3
votes

You could just swap the excerpt and the main content in the backend.... save the content in the excerpt box and vice versa. Otherwise, you need to override 2 WooCommerce templates and reverse the content with the excerpt.

In your theme, add this as woocommerce/single-product/short-description.php. post_excerpt is replaced with post_content.

<?php
/**
 * Single product short description
 *
 * @author      WooThemes
 * @package     WooCommerce/Templates
 * @version     1.6.4
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}

global $post;

if ( ! $post->post_content ) {
    return;
}

?>
<div itemprop="description">
    <?php the_content() ?>
</div>

and this as woocommerce/single-product/tabs/description.php:

<?php
/**
 * Description tab
 *
 * @author      WooThemes
 * @package     WooCommerce/Templates
 * @version     2.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}

global $post;

$heading = esc_html( apply_filters( 'woocommerce_product_description_heading', __( 'Product Description', 'woocommerce' ) ) );

?>

<?php if ( $heading ): ?>
  <h2><?php echo $heading; ?></h2>
<?php endif; ?>

<?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
0
votes

Basically, <?php the_content(); ?> echoes the full description, while <?php the_excerpt(); ?> echoes the short description.

In your layout, just switch them to echo whatever you want. Be sure too that both textareas (content/excerpt) in your product post contain some text.