In a previous tutorial, we showed you how to add decimals to WooCommerce prices in bulk. Here, we show you how to remove decimals from product prices, and the best thing is that you will be able to do it if you are using periods or commas as decimal markers.
You will not simply remove the decimals from all product prices, but you will be able to remove the decimals from the regular price, the sale price, or both prices at once.
We will also show you how to find all products that have a specific decimal like .99 in any of the product prices. All this will allow you to remove decimals in a more specific way and without using any code or programming anything.
We’ll use the WP Sheet Editor – WooCommerce Products plugin. It allows you to view and edit products using an intuitive spreadsheet inside WordPress.
You can download the plugin here:
Download WooCommerce Products Spreadsheet Plugin - or - Check the features
Once you install and activate the plugin, you need to follow these simple steps to remove decimals from your WooCommerce product prices.
1- Open the WooCommerce products spreadsheet
If you need to set up the products spreadsheet, follow this guide.
If you already set up the spreadsheet, you can open the products spreadsheet by going to WP Sheet Editor > Edit Products.
You’ll see all your products displayed in the spreadsheet as rows and their fields as columns.
As you can see, we have several prices with decimals in the Regular Price column:
2- Optional: Search for products with a specific decimal like .99 in the regular or sale price
Before you remove the decimals from your product prices (regular or sale), we want to show you that WP Sheet Editor allows you to search for all the products that have a specific decimal like .99 in the price.
This can be really useful if you don’t want to edit all the prices, but the prices containing the .99 decimal only.
You need to open the Search tool with one click.
Once you open the search tool, select the following values to search for all the products containing a decimal in their prices:
- Tick the Enable advanced filters checkbox.
- Field: Regular Price
- Operator: CONTAINS
- Value: .99
- Click Run Search
Note: You can select Sale Price instead of regular to filter the sale prices. You can also click Add new and select Sale Price to search for both regular and sale prices.
Once you filter the products, all the products that meet the required filters will be displayed in the spreadsheet. This is how you can easily search for products with a specific decimal in their prices.
3- Open the “Bulk Edit” tool to remove decimals from product prices
The Bulk Edit tool allows you to apply massive changes to hundreds of products at once. In this case, you won’t have to open and edit products one by one; you can remove decimals from all product prices at once.
Click Bulk Edit on the toolbar.
4- Remove decimals from regular price, sale price, or both
Once you open the bulk edit tool, you can select some simple values to remove the decimals from your product prices.
a) How to remove decimals using period from regular prices
You need to select the following values to remove the decimals from all regular prices:
- Select the rows that you want to update: Edit all the rows from my current search (including non-visible rows)
- What field do you want to edit: Regular Price
- Select type of edit: Custom Formula
- Only for advanced users: Here you need to paste the formula.
Formula for prices using PERIOD as decimal separator:
=REPLACE(""[::regex::]/^(\d+)(\.\d+)?/"", ""$1"")
Formula for prices using COMMA as decimal separator:
=REPLACE(""[::regex::]/^(\d+)(\,\d+)?/"", ""$1"")
- Select Edit only parent products
- Click Execute Now.
Once you click the Execute Now button, the decimals will be removed from all the selected products.
b) How to remove decimals from sale prices
Select the following values in the Bulk Edit tool to remove the decimals from the sale prices of the selected products:
- Select the rows that you want to update: Edit all the rows from my current search (including non-visible rows)
- What field do you want to edit: Sale Price
- Select type of edit: Custom Formula
- Only for advanced users: Here you need to paste the formula.
Formula for prices using PERIOD as decimal separator:
=REPLACE(""[::regex::]/^(\d+)(\.\d+)?/"", ""$1"")
Formula for prices using COMMA as decimal separator:
=REPLACE(""[::regex::]/^(\d+)(\,\d+)?/"", ""$1"")
- Select Edit only parent products
- Click Execute Now.
c) How to remove decimals from both regular and sale prices at once
If you don’t want to apply these changes separately and save time and clicks, you can apply the custom formula to both the Regular Price and the Sale Price columns. Just select these values:
- Select the rows that you want to update: Edit all the rows from my current search (including non-visible rows)
- What field do you want to edit: Select Regular Price and Sale Price
- Select type of edit: Custom Formula
- Only for advanced users: Here you need to paste the formula.
Formula for prices using PERIOD as decimal separator:
=REPLACE(""[::regex::]/^(\d+)(\.\d+)?/"", ""$1"")
Formula for prices using COMMA as decimal separator:
=REPLACE(""[::regex::]/^(\d+)(\,\d+)?/"", ""$1"")
- Select Edit only parent products
- Click Execute Now.
Important questions
1- Can I remove decimals from variation prices?
Yes. You just need to select the Edit only variations option instead of the Edit only parent products option.
2- Can I remove decimals from other types of prices?
Yes. You can apply this WP Sheet Editor custom formula to remove decimals from other price types. For example, you can remove decimals from country price fields created with the Price Based on Country for WooCommerce plugin.
How simple!
As you see, you can easily remove decimals from your WooCommerce product prices with this custom formula. Forget about editing products individually and spending a lot of hours and clicks.
You can download the plugin here:
Download WooCommerce Products Spreadsheet Plugin - or - Check the features