Home Forums Themes Support How to show product category description in WooCommerce?

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #4264

    Hi all customer,

    In this topic tutorial to we’ll help you show product category description in WooCommerce.

    Fist of all, before customize anything in them you should backup it first and use child theme to customize follow this topic:

    How to customize WordPress theme using Child theme

    Step 1: Insert description for Product Category

    Step 2: Use child theme to customize template display. In this case the template to customize is: wp-content/themes/xxx/woocommerce/archive-product-default.php (similar is archive-product.php if use default theme of WooCommerce or archive-product-ajax.php if you use setting Ajax style in our theme options)

    Then go to area you want to display description and insert this code:

    <?php
    // Show category description
    $term_object = get_queried_object();
    ?>
    <div class="woocommerce-category-description">
    <div class="product-description"><?php echo esc_html( $term_object->description ); ?></div>
    </div>

    It will similar like this:

    Step 3: Add custom CSS to make it display fine

    You can add custom CSS in child theme (style.css) or in Appearance -> Customize -> Additional CSS:

    .product-description {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    }

    and the result

    Hope this help and thanks for reading!

    CSS Customize reference: https://www.youtube.com/watch?v=_OJ8mByfDUU

    *****

    Best regards,

    HaruTheme

    • This topic was modified 2 years, 9 months ago by admin.
    • This topic was modified 2 years, 9 months ago by admin.
    • This topic was modified 2 years, 9 months ago by admin.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.