Deleting all products from WooCommerce via the database is a task that calls for caution. If you are not careful, you can cause irreversible damage to your database. We strongly recommend creating a full backup of your database before you make any changes.
Here is how to delete all products using phpMyAdmin, a widely used database management tool in WordPress hosting environments:
- Back up the database: Before you take any other steps, back up your database. You can usually do this in your web hosting control panel (such as cPanel) or directly in phpMyAdmin.
- Open phpMyAdmin: Log in to your cPanel or hosting dashboard and navigate to phpMyAdmin.
- Select the database: On the left side of the phpMyAdmin dashboard, select the database that contains your WordPress website. If you are not sure which database is yours, check the
wp-config.phpfile in your WordPress installation directory to find the database name. - Run the SQL command: Once you have selected the correct database, click the “SQL” or “Run SQL” tab to enter an SQL statement manually. You should now see a field where you can enter your SQL code. Paste the following SQL code:
sql
-
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = ‘product’);DELETE relations.*, taxes.*, terms.*
FROM wp_term_relationships AS relations
INNER JOIN wp_term_taxonomy AS taxes
ON relations.term_taxonomy_id=taxes.term_taxonomy_id
INNER JOIN wp_terms AS terms
ON taxes.term_id=terms.term_id
WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product');
DELETE FROM wp_posts WHERE post_type = ‘product’;This code deletes all products along with their associated metadata and taxonomy relationships. Note that your table prefix may differ: the default prefix is “wp_”, but if you set a different one when installing WordPress, you need to adjust the code accordingly.
- Verify the changes: After running the SQL command, all products should be removed from WooCommerce. You can log in to your WordPress dashboard and go to WooCommerce to check whether the products have been deleted.
Keep in mind that this process cannot be undone once the products have been deleted. If something goes wrong, you may need to restore your database from the backup you hopefully created beforehand. Always be careful when making direct changes to your database, as they can have serious consequences for your website.






















{% endif %}
{% if title and title != "" %}
{{ title }}
{% endif %}
{% if excerpt and excerpt != "" %}