2 easy ways for bulk edit product prices by formula in WooCommerce?

bulk edit product price by formula
Table of Contents

Updating product prices with WooCommerce’s default options has certain limitations. You can only change the prices to a fixed or percentage amount, but there is no possibility to bulk edit product prices by formula in the WooCommerce editor. In fact, one of the most common questions of WooCommerce store managers is how to bulk edit product prices by formula in WooCommerce.

If you also want to change the price of your products according to a specific formula and are looking for an ideal solution, read this post. Here, first, we will teach you how to use coding for bulk editing product price by formula, and then we will introduce you to WooCommerce products bulk edit pro plugin, with the help of which you can use any formula to bulk edit your product prices.

Use coding to bulk edit product prices by formula

If you are familiar with coding in WordPress, you can use the following guide to bulk edit product prices by any formula. Before you use this code to change the product prices, keep the following points in mind:

  • To add code to your WordPress site, use one of the following methods:
  1. Create a child theme and save the code in the functions.php theme file located in the Appearance ➡ Theme File Editor path.
  2. Use the Code Snippets plugin to add your code to WordPress.
  • Before you add any codes to your site, be sure to back up the data so that you can restore the site to its previous state in case of any problems.

Now you can get help from the following coding for bulk editing product price by formula for WooCommerce:

function filtering_product_prices( $price, $product ) {
$price = (float)$price;
$new_price = $price * 1 ;

return ceil($new_price);
add_filter('WooCommerce_product_get_price', 'custom_price', 90, 2 );
add_filter('WooCommerce_product_get_regular_price', 'custom_price', 90, 2 );
add_filter('WooCommerce_product_variation_get_regular_price', 'custom_price', 99, 2 );
add_filter('WooCommerce_product_variation_get_price', 'custom_price' , 99, 2 );
add_filter('WooCommerce_variation_prices_price', 'custom_variation_price', 99, 3 );
add_filter('WooCommerce_variation_prices_regular_price', 'custom_variation_price', 99, 3 );
function custom_price( $price, $product ) {
return filtering_product_prices( $price, $product );
function custom_variation_price( $price, $variation, $product ) {    
return filtering_product_prices( $price, $product );

In order to be able to apply the desired changes to the product price using a formula, you must change the new price variable, which is highlighted in yellow, to your desired formula. Let’s give some examples to make it clear to you.

Example 1: Cut the regular price by half

To cut all regular prices by half, simply replace the yellow highlighted line below: 

$new_price = $price * 0.5;

Example 2: Increase the regular prices of the Accessories category by 25.

To make such a change, replace the following code:

if (has_term( 'accessories', 'product_cat' )) {   
return ceil((float)$price + 25);  

Example 3: Decrease all products in the Accessories category by 10% and increase the price of Hats by one-third.

To do this, you need to make the below changes:

if (has_term( 'accessories', 'product_cat' )) {   
return ceil((float)$price *1.1);  
} elseif (has_term( 'hats', 'product_cat' )) { 
return ceil((float)$price*4/3); 

Example 4: Decrease the price of all products cheaper than $100 by 15.
Use the below code to make this change:

if ( $price < 100 ) {  
return ceil((float)$price-15);  

Use WooCommerce products bulk edit pro plugin to bulk edit product prices by formula

WooCommerce products bulk edit plugin provides you with the most useful tools and options which is needed to bulk edit any product features. By getting help from this plugin, you can easily filter your products and then make any changes in their WooCommerce fields.

One of the important uses of this plugin is to bulk edit product prices by formula for WooCommerce. Making these changes on your WooCommerce site is possible by following the 3 simple steps:

Step 1: Install WooCommerce products bulk edit pro plugin

The first step to using the WooCommerce products bulk edit pro plugin is to download and install it on your WordPress website.

After installing and activating the plugin, you will see its bulk editing option in the WordPress dashboard. Then, by pressing Woo Products, you can visit the main page of this bulk editing plugin..

WooCommerce product bulk edit plugin

Step 2: Filter the desired products

On the main page of the WooCommerce product bulk edit pro plugin, a list of all products is observed with a comprehensive toolbar designed at the top of the table. The first icon in this toolbar is used for opening the Filter Form.

select woo products menu and choose filter button in bulk edit plugin

As you may notice in the picture below, the Filter Form has been divided into eight sections, providing all the WooCommerce fields for filtering the products. 

You can use this form to filter your desired products based on any value, like stock quantity, price range, category, etc. In the following example, we will show you how to use these effective Filter Form before bulk editing product price by formula.

select general tab in filter form bulk edit plugin

Step 3: Bulk edit product prices by formula

After filtering the products, you have to follow the below instructions to bulk edit product price by formula for WooCommerce: 

  • Mark some of the products in the product table to select them for bulk editing their prices.
  • Open the Bulk Edit form by clicking on the icon illustrated below:
mark products and select bulk edit button in bulk edit plugin
  • In the Bulk Edit form, go to the Pricing tab.
  • In front of the Regular Price, there are three boxes. 

The first box is a list of operators:

  • Set New: Set new value for product price.
  • Clear Value: clear or remove product price value.
  • Formula: Change product price value by formula.
  • Increase by Value: Increase product price by value.
  • Decrease by Value: Decrease product price by value.
  • Increase by %: Increase product price by percentage.
  • Decrease by %: Decrease product price by percentage.
  • Increase by Value (From sale): Increase product price by value based on product sale value.
  • Increase by %(From sale): Increase product price by percentage based on sale value.
select regular price options in bulk edit form to bulk edit product prices by formula

If you choose Formula from the drop-down list in this box, you can write a formula in the next box.

You can use all mathematical operators to write a customized formula, including:

  • Multiplication (*) 
  • Division (/) 
  • Addition (+) 
  • Subtraction (-)

Note: By choosing Increase/ Decrease by value/%, you can add or subtract any fixed/percent amount from the current value. It is also possible to bulk edit the regular price based on the sale price by selecting Increase by Value/% (From sale). The same options are available for Sale Prices as well.

The last box is used to round the price if needed. 

  • After writing the formula, you need to press the Do Bulk Edit button to let the plugin update the regular prices of the selected products based on it.

To help you write the formula correctly and exactly based on your needs, we are going to make some examples in the following.

select formula in regular price action in bulk edit form

Example 1: Increase the regular price of products in the Accessories or Clothing categories by formula

To successfully fulfill the purpose of this example, the below steps are required: 

  • Go to the Filter Form and open the Categories/Tags/Taxonomies tab. Choose OR from the first combo box of the product categories field, then select Accessories and Clothing from the list of categories in the next box.
select accessories and clothing categories in filter form
  • Press the Get Products button to filter the products, then mark any of them in the table and open the Bulk Edit form.
result change regular price by formula in accessories and clothing categories

As we mentioned above, you need to go to the Pricing tab, choose Formula from the first combo box, and write the below formula in the next box:

(X * (0.40))+20)

Please note that in all formulas used in this plugin, X represents the current value of product prices.

To round the prices, you can choose one of the default options of the third combo box. For example, we chose 99.

write desired formula in bulk edit form

Now, by pressing the Do Bulk Edit button, all prices of selected products are increased by 10%, as we expected.

result customization formula in regular price column

Example 2: Decrease the regular prices of the products that their stock quantities range from 5 to 20 by one-third

The Steps to reach the purpose of this example are as follows:

  • Open the Filter Form and go to the Stock tab, find the Stock Quantity field, and set 5 and 20 for the first and second boxes, respectively.
select stock tab in filter form
  • Click on the Get Products button to see the filtered product in the table.
  • Mark the checkbox next to the ID to select all the products.
mark checkbox ID in all products bulk edit form
  • Open the Bulk Edit form and go to the Pricing tab. 
  • After choosing the formula, write the below formula in the second box:


By clicking on the Do Bulk Edit button, you can see that all regular prices have been changed according to the written formula.

Here, you can find more examples of bulk editing product price for WooCommerce.

WooCommerce product bulk edit plugin


As you know, editing the price of WooCommerce products individually is a difficult and time-consuming task. It is true that WooCommerce allows you to bulk edit product prices by its default editor, but it is not flexible enough. Especially when you want to change the price of products based on a certain formula, this is not possible without using coding or the WooCommerce products bulk edit pro plugin. In this article, we have provided a complete guide to using both of these methods. If you need more information about using the WooCommerce products bulk edit pro plugin, please leave a comment.

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.