Add product tags

This article explains how to automatically add tags to your WooCommerce products.

1

Identify fields to use for tags

First you need to identify the product fields you want to pull the tag values from. In this example, I will pull the tag values from 2 product fields: category & productgroup. You can see those fields when you view a product's details (by clicking the product's name):

Identify fields to use for tags
2

Create a custom plugin

If you haven't done so already, create a custom plugin.

3

Add custom code

Add the following code to your custom plugin file.

4

Modify code

The $fields array (line #20) allows you to set which fields should be used as tags. Notice that these are the exact fields found in the product details (see image above).

The $search array (line #21) allows you configure the delimiters used for each field. Some fields have multiple values separated by various characters such as ; and , and >.

5

Add/Update product sets

These changes will only take effect after any new Product Sets are created or after existing Product Sets are updated.

Still need help? Contact Us Contact Us