Normalize brand names
This article explains how to normalize brand names.
Occasionally, a product will have different brand names. For example, a pair of shoes might have the brand name Nike whereas other pairs of shoes might have the brand name Nike, Inc..
By normalizing brand names, we can reduce brand name variations to one version.
Before
After
Before you begin
Before brand names get imported into your WooCommerce store, you must first make sure you have added the attribute "Brand". To do this, go here WordPress Admin Area > Products > Attributes. Add the word Brand in the "Name" field and then click the [Add Attribute] button.
- 1
-
Create a custom plugin
If you haven't done so already, create a custom plugin.
- 2
-
Add custom code
Add the following custom code
- 3
-
Edit brand names
On lines 23~26 of the above code, you will find the code that needs to be edited for your purposes.
For example, this line
$ai->add_term( "Black Diamond", [ "Black Diamond Equipment", "Black Diamond Inc" ] );
will replace "Black Diamond Equipment", "Black Diamond Inc" with "Black Diamond".Learn more about Import Attributes for Products.
- 4
-
Add/Update product sets
These changes will only take effect after any new Product Sets are created or after existing Product Sets are updated.