Sometimes, we want to have a possibility to put the special two-three word of each of our products and show them to our visitors so they can have a better picture of the product purpose.

I had 100+ situations like this where clients want to show this simple sentence or a few words in their archive pages so they can have a better engagement and set a clearer picture of the product’s purpose.

In order to have that special field for each of our products on the archive or category page, we have to create a special custom meta field for our products.

We can create that field custom, but in this case, I’m going to use a very popular plugin called ACF (Advanced Custom Fields).

All we will need is available in the free version and plugins is very safe so you don’t have to worry about that.

1. Install ACF plugin

2. Create a new field group for your product post type and add a new field that you will use for this purpose.

If you are asking yourself how to do that please follow this 2 min tutorial: https://share.vidyard.com/watch/2o8Xm7cP24tWLdNLRPayxz?

3. Open your product in the dashboard and type in that newly created field whatever you want to show 🙂 then, save/update the product.

4. In your function.php file, paste the code below:

// Show highlighted text
function cs_show_highlighted_text() {
    global $product;
    $highlighted_text = get_field('highlighted_text', $product->get_id());

    if ( !empty($highlighted_text) ) {
        echo '<p class="highlighted-text">' . $highlighted_text . '</p>';
    }
}
add_action('woocommerce_after_shop_loop_item', 'cs_show_highlighted_text', 5);

Now, your custom text should be displayed like on the image below

How to add a custom text on product archive page in woocommerce

Let me know if you have any questions or if you need help 🙂