Use MySQL Expressions for WooCommerce to Edit Product Details via Import
Managing your store, you may have tasks that can’t be solved via the native admin panel. In this article, we’ll show you how you can solve some of the typical tasks by applying a MySQL expression for WooCommerce during import.
Add a Brand Name to a Product Title in WooCommerce
Below you can see a sample file where product title and brands are located in separate columns. It is a typical file that you may receive from your supplier. What if you want a brand name to be added to a title so it looks like Lima Flooring Ramp Section, for example?
This task can be solved by applying an SQL expression during import via Store Manager for WooCommerce.
Here are the steps to add a brand to a product title.
- Launch Store Manager for WooCommerce import wizard.
- Select your import file and proceed to the step Field Links.
- Find a Title field and open SQL Editor.
- In the Expression Editor, add the following expression:
- Press Execute Expression to see the selected fields and current values. Then press Next to preview the result.
- Press OK to close the Expression Editor and return to the import wizard.
- Complete the import and check the result at your store.
See the detailed guide on importing products via Store Manager for WooCommerce.
CONCAT([SOURCE_FIELD(Brands)],' ',[SOURCE_FIELD(Title)])
Add Price Mark-Up or Apply Exchange Rate
You may need to increase prices by a certain percentage to add price markup or apply an exchange rate. Below is a sample file with products and prices.
Let’s increase the price by 20% in the course of import. Here are the steps to follow.
- Launch Store Manager for WooCommerce Import Wizard.
- Select your import file and proceed to the step Field Links.
- Find a Regular Price field and open SQL Editor by clicking Edit next to the field name.
- Enter the expression:
[_regular_price]*1.2
(the coefficient increases the price by 20%) - Click Execute Expression to see the selected field and current value. Then click Next to execute the expression and check the result.
- If the result is as expected, click OK to return to the import wizard.
- Complete the import and check the result in Store Manager. As you can see, the initial price has been increased.
Change Short Description from Uppercase to Lowercase
Suppose you have a file where all product short descriptions are uppercase and you want them to be lowercase:
To change short descriptions to lowercase, follow these steps:
- Launch Store Manager for WooCommerce Import Wizard.
- Select your import file and proceed to the step Field Links.
- Find a Short Description field and click Edit to open SQL Editor.
- In the Expression Editor window, enter the function LOWER. Enter the parentheses, then put the cursor inside the parentheses.
- Click Insert value from import source. In the dropdown list, select the Short Description field:
- Press Execute Expression to see the selected fields. Then press Next to preview the result.
- Press OK to close the editor and return to the import wizard.
- Check the result in Store Manager.
Update Data for the Out-of-Stock Products
A typical kind of task is to update products on a certain condition. Thus you may want to update prices only for the products with the Out of Stock status.
Here we have a file that contains new prices for the existing products. We’ll show you how to import this file and update prices only for the “outofstock” products.
To update prices via import, follow these steps:
- Launch Store Manager for WooCommerce Import Wizard.
- Select your import file and proceed to the step Field Links.
- Find a Regular Price field and open SQL Editor by clicking Edit next to the field name.
- Enter the expression to update prices only for the out-of-stock products:
IF([SOURCE_FIELD(Stock Status)] LIKE '%outofstock%',[SOURCE_FIELD(Regular Price)],'')
- Press Execute Expression to see the selected fields and sample values.
- Press Next to preview the result.
Press OK to close the Expression Editor and return to the import wizard. Complete the import and check the result in Store Manager. As you can see, the prices for the Out-of-Stock products were updated, and prices for other products from the file are unchanged.
How to Apply Your Own WooCommerce SQL Query
You can use the Expression Editor with the Import Wizard to update data on the go on your own. The steps should be as follows:
- In the import wizard, proceed to the step Field Links.
- Find a field that you want to update.
- Open Expression Editor by clicking Edit in the Expression column.
- Enter the expression.
- Press Execute Expression to see selected fields and sample values.
- Press Next to execute the expression and check the output.
- Press OK to add the expression.
- Complete the import following the wizard prompts.
Using the expression editor with Store Manager for WooCommerce, you can perform a lot of different updates on the go. If you’re hesitant about which formula to use, write in the comments below and we’ll try to help you.
Bulk Add WooCommerce Attributes with Store Manager
Try now FREEStep by Step Tutorial to Import Products
Learn how to import WooCommerce products via Store Manager.Read More...
Mass Changer: Detailed Tutorial
Perform bulk WooCommerce product updates via Mass Changer tool. Read More...
Merge Product Brand Name and Title Upon Import
How to add a brand name to a product title in WooCommerce via import. Read More...
Update WooCommerce Product Tags In Bulk
How to update WooCommerce product tags in mass using WooCommerce Product Tags Mass Changer.Read More...