When working with your PrestaShop store, there will be times where you may need or want to update the prices for all products at once. You may be wanting to give a discount to all products as a store-wide sale, or maybe you need to increase your prices due to an increase in supplies or manufacturers costs. While this can be done for each product one at a time, it can quickly become tedious and time consuming, especially if you have hundreds or even thousands of products. There is a way to do it much quicker by using SQL (Structured Query Language). This cannot be done within the PrestaShop back office. If you are hosting with us here at Web Hosting Hub, you can perfofm this task in your phpMyAdmin tool found in your cPanel.
Making mass price changes using SQL in phpMyAdmin
- Log into your cPanel.
- Now that you are in the cPanel, locate the Databases category and click on the phpMyAdmin icon.
- You are led to the main phpMyAdmin page. Take a look at the left hand sidebar and find the name of your PrestaShop database. Click on the name to begin working with it. Our database for this example is named pres764. If you are not sure of your database name, you can find it by following these instructions.
- After clicking on the database name, the right hand panel will populate with a list of tables. More importantly, the work tabs at the top appear. Click on the SQL tab to open the SQL query editor.
- From the SQL query editor, you will need to enter the code to make the price change. Below are a few sample codes to demonstrate increasing and decreasing prices by both specific amounts and percentages. PrestaShop needs to be updated in two tables to handle the change.
Sample code to increase all prices by twenty percent (20%).
UPDATE ps_product_shop SET price = price*1.20;
UPDATE ps_product SET price = price*1.20;
Sample code to decrease all prices by 15 cents (.25).
UPDATE ps_product_shop SET price = price-.15;
UPDATE ps_product SET price = price-.15;
Sample code to increase all prices by fifty cents (.15).
UPDATE ps_product_shop SET price = price+0.50;
UPDATE ps_product SET price = price+0.50;
Sample code to decrease all prices by ten percent (10%)
UPDATE ps_product_shop SET price = price / 1.1;
UPDATE ps_product SET price = price / 1.1;
- Once you have entered a query with your desired price change, click the Go button at the bottom. This will activate the query and make the change. Your prices should now display with the new changes. Below is a before and after example of a price change where we increased the prices by 10%.