Add Text To WooCommerce Product Category Archive Pages Conditionally

In this post, i’ll show you how easy it is to add some text or any other type of content to one or more WooCommerce product category archive pages.

WooCommerce includes a huge range of hooks which enable you to add extra content anywhere.

On top of this, you can also use the WooCommerce conditional tags in a custom function with any Woo hook to add content.

The 1st method uses a basic custom function which you can add to the end of your child themes functions.php file.

The 2nd method enables you to add different text for each product category and default text for any category not included in the code:

Both solutions enable you to easily change both the:

  • WooCommerce Action Hook – woocommerce_archive_description
  • WooCommerce Conditional Tag – is_product_category()

Related Code


Comments

6 responses to “Add Text To WooCommerce Product Category Archive Pages Conditionally”

  1. Hi,
    I am trying to work out how to have the category description show on every page of the products – I have 30 products which goes over 5 pages and the category description only shows on the first page
    Thanks

    1. Brad Dalton Avatar
      Brad Dalton

      Use the correct woocommerce hook and conditional tag

  2. While adding text via functions.php works, it will make it impossible to edit for anyone you don’t want to give administrator rights to. If you’re handing a site over to a client, you don’t want them messing around in functions.php. There’s a little plugin called Category TinyMCE that adds a WYSIWYG editor to each category page. That would probably be a better option – http://wordpress.org/plugins/categorytinymce/

    1. Brad Dalton Avatar
      Brad Dalton

      But does it work with custom post types generated by plugins?

  3. That’s cool. But do you know a way how to add only text when categories are shown?
    If any product is listed, don’t show the category description.

    1. Brad Dalton Avatar
      Brad Dalton

      Must be a conditional tag for that.

      WooCommerce include a huge range of hooks and conditional tags you can use to modify the default output their plugin generates.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.