Home » WooCommerce: Add Second Description @ Product Category Pages

WooCommerce: Add Second Description @ Product Category Pages

by Tutor Aspire

In terms of SEO, if you’re trying to rank your product category pages, you really need to make the most of the default WooCommerce product category “description” and “thumbnail”. Most themes, if compatible with WooCommerce, will show this content right below the product category name and above products.

Nothing new so far. But what if you want to add another piece of content below the category products while also keeping the default description? Well, we’d need to customize the edit category page and display a new text editor field, save it, and finally display it where we want. So, here’s how they do it!

Add a second description / content area to the WooCommerce product category pages

PHP Snippet: Show Additional Content Below Products @ Product Category Pages

/**
 * @snippet       Add new textarea to Product Category Pages - WooCommerce
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 5
 * @donate $9     https://www.tutoraspire.com
 */

// ---------------
// 1. Display field on "Add new product category" admin page

add_action( 'product_cat_add_form_fields', 'tutoraspire_wp_editor_add', 10, 2 );

function tutoraspire_wp_editor_add() {
    ?>
    
'seconddesc', 'quicktags' => array( 'buttons' => 'em,strong,link' ), 'tinymce' => array( 'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,bullist,numlist,separator,blockquote,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator', 'theme_advanced_buttons2' => '', ), 'editor_css' => '', ); wp_editor( '', 'seconddesc', $settings ); ?>

term_id, 'seconddesc', true ) ); ?> 'seconddesc', 'quicktags' => array( 'buttons' => 'em,strong,link' ), 'tinymce' => array( 'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,bullist,numlist,separator,blockquote,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator', 'theme_advanced_buttons2' => '', ), 'editor_css' => '', ); wp_editor( $second_desc, 'seconddesc', $settings ); ?>

term_id, 'seconddesc', true ) ) ) { echo '

' . wc_format_content( htmlspecialchars_decode( get_woocommerce_term_meta( $term->term_id, 'seconddesc', true ) ) ) . '

'; } } }

You may also like