One of the biggest problems in managing WooCommerce stores is how to bulk edit WooCommerce attributes and bulk add or remove them efficiently.
If you have many products in your store, WooCommerce bulk edit attributes, and saving the changes is challenging and time-consuming.
To solve this problem, we introduced three solutions. If you know what is WooCommerce attributes and their differences with variations ignore the first part of this article and directly jump to the solutions by clicking on below links. Otherwise, you can go ahead and read the full guide.
- WooCommerce update product attribute programmatically,
- Bulk edit attributes WooCommerce by Export/Import,
- Use the WooCommerce product attributes plugin.
What are WooCommerce attributes?
WooCommerce product attributes are useful information that store managers can add to the WooCommerce products to give customers more information about what they decide to buy. For instance, suppose you are selling wines with different sizes of wine bottles. You can add bottle size as an attribute and let your customers see the bottle size of each wine on the product page.
There are also other reasons for assigning attributes to your products, including:
Group products with the same attribute: WooCommerce Product attribute is a type of taxonomy that helps you to group products by defining a term. For example, you can define Color as an attribute and assign different terms like Red, Yellow, Blue, etc. To it. Then you can group your blue products.
Let customers find and filter products faster: By adding WooCommerce attributes, you can display a filter widget on your store navigations to enable customers to filter products by attributes.
Create variations and offer variable products to customers: One of the most popular purposes for adding WooCommerce product attributes is creating variations. You can combine two or more terms of attributes to create a single variation and let customers order that specific variation of product among others.
How to add product attributes in WooCommerce?
To add product attributes in WooCommerce, you can simply navigate to the WordPress dashboard > Products > Attributes.
Then add a new attribute by inserting a Name and a Slug in the related textboxes. Finally, click the Add Attribute button to create a new one like Bottle Size.
Now, to define different terms for bottle sizes like 1.5 liters, 3 liters, 750 ml, etc., you need to press Configure Terms as shown below:
Then add your desired terms one by one:
What is the difference between WooCommerce product attributes and variations?
WooCommerce attributes are the features of your products that you want to inform customers about. Customers can not choose one or more attributes on the product page. They can just review different terms that you have assigned to the product. For example, you can inform them that the Red Wine has 750 ml bottle size.
However, the variations are a combination of some terms assigned to each product attribute individually. When you combine some attribute terms to create variations, your customers can choose one of the variations from the product page and order it. For example, you may set 1.5 liter, 3 liter, and 750 ml as variations for Red Wine. So, customers can choose one of them on the product page and order it.
You can also set different prices for each variation. So, when customers choose their favorite one, they can see updated prices on the product page.
To use WooCommerce attributes as variations, you first need to choose Variable Product from the Product Type field.
Then, in the product Attributes tab, add all the necessary attributes, and mark the Used for Variations field finally click the Save attributes button.
Finally, go to the Variations tab and press Generate Variations to see a list of combination attribute terms as product variation. You can now open each variation and make the necessary changes.
WooCommerce update product attributes programmatically in bulk
Adding product attributes programmatically is a suitable method for managers with coding skills. Using PHP codes saves time, especially when you want to bulk add attributes to WooCommerce products.
Note: We recommend you get a backup from your website before using this method. It is also a good idea to create a child theme and then insert your custom functions.php file into the child theme.
WooCommerce add attributes to products programmatically in bulk
Here, you can find useful PHP codes to add attributes and terms to all products in WooCommerce.
This is a useful code for WooCommerce create attributes programmatically like size and color with terms like XL, small, brown, gray, and yellow to your products.
add_action('admin_init', 'ithemeland_add_product_attributes');
function ithemeland_add_product_attributes(){
$atts=array(
'size'=>array('XL','Small'),
'color'=>array('brown','gray','yellow'),
);
foreach ($atts as $key => $values) {
new add_attribute($key,$values);
}
}
class add_attribute{
/*
* Register a global WooCommerce product attribute Class.
*
* @param str $nam | name of attribute
* @param arr $vals | array of variations
*
*/
public function __construct($nam,$vals){
$attrs = array();
$attributes = wc_get_attribute_taxonomies();
foreach ($attributes as $key => $value) {
array_push($attrs,$attributes[$key]->attribute_name);
}
if ( ! in_array( $nam, $attrs ) ) {
$args = array(
'id' => '',
'slug' => $nam,
'name' => __( $nam, 'WooCommerce' ),
'type' => 'select',
'orderby' => 'menu_order',
'has_archives' => false,
'limit' => 1,
'is_in_stock' => 1
);
return wc_create_attribute( $args );
}
$this->add_var($nam,$vals);
}
public function add_var($nam,$vals ){
$taxonomy = 'pa_'.$nam;
$term_slug = sanitize_title($nam); // Check if the term exists and if not create it (and get the term ID).
for ($ff=0; $ff term_id;
}
}
}
}
You can change the attributes and terms in the array lines to make the changes you want as below
function ithemeland_add_product_attributes(){
$atts=array(
'new-attribute'=>array('aside','beside','long','none','short'),
);
By adding this code to the functions.php file, when you navigate to Products > Attributes in your WordPress dashboard, to see the added attributes and terms:
These attributes can be used to create product variations as well:
Please note that this code is unsuitable for removing any attributes and is not written to add terms to specific products.
Bulk edit product attributes in WooCommerce product attributes plugin
If you want to more flexibly bulk edit product attributes in WooCommerce, we recommend using the WooCommerce variations bulk edit plugin. With help from this plugin, you can quickly and easily filter any product in your WooCommerce store and bulk edit attributes in WooCommerce.
WooCommerce bulk variations editing plugin allows you to filter products based on specific product fields and bulk edit product attributes with just one click.
With the help of this plugin, instead of adding different attributes to the products one by one, you can add or even remove them based on the desired categories and filters at once.
WooCommerce Variations Bulk Edit Plugin
The easy way to bulk edit product attributes in WooCommerce
Let’s show you an example of using this powerful plugin for bulk editing product attributes in WooCommerce.
Example: Add a Red attribute to the Large products in the Clothing category
To start using the plugin, first, you need to install and activate WooCommerce variations bulk edit plugin to see the IT bulk editing tab in the WordPress dashboard.
Then, by choosing the Woo Variations menu, the plugin’s main page displays a list of all products in your WooCommerce store.
To bulk add product attributes with this plugin, follow these three simple steps:
- Filter desired products.
- Select filtered products in the table.
- Open Manage variations form for bulk edit product attributes.
Continue reading to see how easily you can do these three steps in this plugin.
Step 1: Filter desired products
To open the comprehensive filter form designed in this plugin, click the Filter icon on the top toolbar.
In the Filter form, you can find seven tabs allowing you to find the WooCommerce fields for filtering the products more conveniently.
In this example, we aimed to filter large products in the Clothing category, so we tried to:
- Open the Categories/Tags/Taxonomies tab in the Filter form.
- Add Clothing to the Product categories field.
- Add Large to the Product size field.
By pressing the Get Products button, our preferred products are listed in the table.
Step 2: Select filtered products in the table
Before opening the Manage Variations form to add product attributes, mark some products in the table, as shown below.
Then, you can click on the Manage Variations icon and choose the Manage Variations option from the list.
Now, you can see the Manage Variations form, and you are ready to update product attributes by following the steps.
Step 3: WooCommerce bulk add attributes
In the Manage Variations form, you can find all attributes with their terms in different boxes on the right side of the page.
So, it is simply possible to add as many terms as you need just by:
- Marking the terms in the attribute boxes – Red in this example,
- Choosing the All variations (All products) option from the Generate list,
Note: There are also some other options in the Generate list you can use to add variations to the products, which are:
- All variations (This product): All variations created by the selected attributes are assigned to one product displayed in the table of this page.
- Individual variations (This product): You can choose one term from each attribute to add one variable individually to one product displayed in the table of this page.
- Individual variations (All products): You can choose one term from each attribute to add one variable to all selected products individually.
You can find more information about using these options here.
- Selecting the variations you need in the Possible combinations form – We chose Red | large and Red | Medium in this example.
- Click on the Generate Variations button.
Now, you can return to the main page and observe that the selected attribute is added to the selected products.
The powerful tools and options available in the WooCommerce bulk variations editing plugin are not limited to adding attributes to products. You have many managing options for bulk edit attributes WooCommerce, for example:
- You can use the New button on the right corner of each attribute box to add new terms and assign them to the products.
- You can edit the attributes and variations of the selected products individually using the Edit icon related to them.
- You can access the Bulk Edit form to bulk edit product attributes by selecting as many variations as you need and clicking the Bulk Edit icon at the top of the table.
In the bulk edit variations form, you can make any changes to the variable products as illustrated below:
- A trash icon on the top of the table allows you to bulk remove selected attributes with just one click.
Bulk edit attributes in WooCommerce by Export/import
Exporting products to a CSV file containing a list of your WooCommerce products with the attributes assigned to them is another method for WooCommerce bulk editing product attributes.
To use this method, you can get help from an Import/Export button on the top toolbar of the WooCommerce variation bulk edit plugin designed for this purpose.
The steps are as follows:
- Filter the products you need using Filter Form.
- Select the products in the table.
- Press the Import/Export button on the toolbar.
- In the import/export page, choose Only Selected Products and Only Visible fields.
- Click on the Export Now button to download the CSV file.
- Open the CSV file in Excel, edit the attributes, and save the file.
- Go to the plugin and open the Import/Export page again.
- Click on the Import Now button.
- Choose the edited CSV file from the destination and click on import.
You’re done. All attributes you edited in the Excel file are now added to WooCommerce.
Extra Features of WooCommerce variations bulk edit plugin
In addition to WooCommerce bulk add attributes, there are more features available in this plugin for attaching, swapping, and removing multiple attributes at once.
It is also possible to export product attributes of WooCommerce in CSV format.
Let’s review how to use these features by making some examples
bulk add attributes WooCommerce by attaching
To attach attributes to one variable product, we designed the Attaching tab in the variations bulk edit form. By opening this tab, you can see a list of Attributes in your WooCommerce store under the Select Attribute field.
So, you can easily attach attributes by following the below instructions:
- Choose the attribute from the list – Color in this example.
- Select one of the terms like Green.
- If the term you want to attach to your variable product is not in the list, press the New button and add a new term, such as Pink.
- Click on the Attach button.
Bulk edit attributes WooCommerce by Swapping
Another useful feature for bulk edit attributes WooCommerce is swapping the terms with each other. For example, suppose that you want to swap the Blue with Gray attribute in some variable products.
First, you need to filter and select them in the product table as we described in the previous examples. Then, follow the below steps:
- Open the Swap tab in the variations bulk edit form.
- In the From section: Choose Color from the Select attribute field. Then open the combo box of Select term and choose Blue.
- In the Replace with field: Select Gray from the Term list.
- Press the Swap button.
Bulk delete WooCommerce attributes
In the variations bulk edit form, you can go to the Delete Variations tab and choose one of the below options to bulk delete WooCommerce attributes:
Delete all product variations
If you choose this option, all variations of the products you have selected in the product table will be removed.
Delete the product variations according to the combination of the attributes
By choosing this option, you can select one of the attributes to bulk remove from the selected products. For example, if you select Color from the Select attribute field, then choose Yellow from the Select Term list, and press the Submit button, all variations created with Yellow and assigned to the selected products will be removed.
Export product attributes WooCommerce
WooCommerce export product attributes is another useful feature of the WooCommerce bulk editing variations plugin. As we explained before, it is very easy to WooCommerce export attributes of all products just with one click by using the export option in the Import/Export tab.
However, it is also possible to export attributes of some WooCommerce products from your store. To do this, you need to follow the below instructions:
- Filter and select the products you want to export product attributes WooCommerce.
- Add Attributes columns to the table – If you need help for using the column manager form, click here.
- Click on the Import/Export tool in the toolbar.
- Choose Only selected Products and Only Visible Fields as illustrated below.
- Press Export Now so a CSV file will be downloaded and saved on your computer.
WooCommerce Variations Bulk Edit Plugin
The easy way to bulk edit product attributes in WooCommerce
Summary
In this article, we shared three practical ways to bulk edit product attributes in WooCommerce. Among these methods, the bulk edit attributes by the WooCommerce variations bulk edit plugin is the easiest and fastest method. If you have any problem using this plugin, share it with us in the comments.