简体   繁体   中英

Move product category description after displayed category products in Woocommerce

i have one issue with Category Description text Currently is placed on top of product category, and i want to place it at bottom after products.

类别描述

class that is control that part is:

.term-description

and want to place here, after all category products:

在此处输入图片说明

I found this function:

function woocommerce_taxonomy_archive_description() {
if ( is_tax( array( 'product_cat', 'product_tag' ) ) && get_query_var( 'paged' ) == 0 ) {
    $description = wpautop( do_shortcode( term_description() ) );
    if ( $description ) {
        echo '<div class="term-description">' . $description . '</div>';
    }
}
}

but not works.. Can someone to help me with this? i want to move only category desctiption without title at top.

The following hooked function will move only product category description after the loop display:

add_action('woocommerce_archive_description', 'custom_archive_description', 2 );
function custom_archive_description(){
    if( is_product_category() ) :
        remove_action('woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
        add_action( 'woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 5 );
    endif;
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM