Blog

How to bulk edit product attributes in WooCommerce?(Simple and variable products)

bulk edit product attributes
Table of Contents

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, bulk editing product attributes and saving the changes is challenging and time-consuming. 

To solve this problem, we introduced three solutions:

  1. Use the PHP codes to bulk edit attributes WooCommerce, 
  2. Export WooCommerce product to a CSV file and bulk edit product attributes in Excel, 
  3. Use the bulk edit plugin to bulk edit attributes in WooCommerce.

This post teaches you how to bulk edit attributes in WooCommerce with these solutions.

Update product attributes programmatically in WooCommerce

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 bulk add attributes with PHP codes

Here, you can find useful PHP codes to add attributes and terms to all products in WooCommerce.

This is a useful code for adding attributes 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:

result codes attributes terms

These attributes can be used to create product variations as well:

attributes product variations

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 by WooCommerce variations bulk edit 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 Banner

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.

select woo variations menu

To bulk add product attributes with this plugin, follow these three simple steps: 

  1. Filter desired products.
  2. Select filtered products in the table.
  3. 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.

select filter icon on 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.
filter large products in clothing category

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.

marking products for manage variations

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: Bulk add attributes to WooCommerce products 

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.

add variation color red for all products
  • 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.
select variations possible combinations

Now, you can return to the main page and observe that the selected attribute is added to the selected products.

result manage variations

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:

  1. You can use the New button on the right corner of each attribute box to add new terms and assign them to the products. 
  2. You can edit the attributes and variations of the selected products individually using the Edit icon related to them.
  3. 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.
tools and options bulk variations

In the bulk edit variations form, you can make any changes to the variable products as illustrated below:

bulk edit variations form
  1. A trash icon on the top of the table allows you to bulk remove selected attributes with just one click.

Export products to a CSV file to bulk edit attributes, then import again

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.
import and export products
  • In the import/export page, choose Only Selected Products and Only Visible fields.
  • Click on the Export Now button to download the CSV file.
select product and fields options for import and export CVS 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.  
edit attributes CVS file and select 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

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.

select menus variations bulk edit plugin

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.

bulk add attributes by attaching in WooCommerce

So, you can easily attach attributes by following the below instructions:

  1. Choose the attribute from the list – Color in this example.
  2. Select one of the terms like Green.
  3. 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.
  4. Click on the Attach button.
add color green attribute in WooCommerce

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:

  1. Open the Swap tab in the variations bulk edit form.
  2. In the From section: Choose Color from the Select attribute field. Then open the combo box of Select term and choose Blue.
  3. In the Replace with field: Select Gray from the Term list.
  4. Press the Swap button.
add color green attribute in WooCommerce

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. 

bulk delete attributes in WooCommerce

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.

delete product variations according to combination attributes in WooCommerce

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.
export product attributes in WooCommerce
  • Choose Only selected Products and Only Visible Fields as illustrated below.
select products and fields to export in WooCommerce
  • Press Export Now so a CSV file will be downloaded and saved on your computer.
WooCommerce variations bulk edit plugin Banner

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Shopping cart
Sign in

No account yet?

We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies.

Start typing to see products you are looking for.