Reputation: 1
I'm currently facing an issue with my WooCommerce store and would appreciate any insights or solutions you might have.
Here’s what I’m trying to achieve: I want to display the product category description on my category pages, specifically below the pagination and above the product listings. I've been following various tutorials, but I haven’t had any success so far.
Here’s what I’ve done:
I located the archive-product.php file in my theme and made modifications to include the category description. I’ve used the following code in my archive-product.php file:
if ( is_product_category() ) : ?>
<div class="category-description">
<?php
echo term_description(); // Display the product category description
?>
</div>
<?php endif;
What I’ve Observed:
I added a debug message to confirm that the archive-product.php template is loading, but I haven’t seen any output confirming this. I verified that I’m on the correct product category page, but the description still does not appear. My Environment:
I’m using the Active7 theme (child theme of The7).
Everything mentioned above
Upvotes: 0
Views: 113
Reputation: 69
You can try this function
// Display category description below pagination and above product listings
add_action( 'woocommerce_before_shop_loop', 'display_category_description', 5 );
function display_category_description() {
if ( is_product_category() ) {
$term_description = term_description();
if ( ! empty( $term_description ) ) {
echo '<div class="category-description">' . $term_description . '</div>';
}
}
}
Upvotes: 0