0

Is it still possible to delete all producs in Magento 2 using:

DELETE FROM `catalog_product_entity`;

Will it still clean all other tables that have product data because of the foreign key constraints? What about the URL rewrites, will that also be cleaned?

https://stackoverflow.com/questions/8899366/deleting-all-products-on-magento describes how to do it for Magento 1.

0

You will run delete query on catalog_product_entity table then below tables record will be deleted as entity column of catalog_product_entity is be related using the foreign keys:

catalog_category_product
catalog_compare_item
catalog_product_bundle_option
catalog_product_bundle_price_index
catalog_product_bundle_selection
catalog_product_entity_datetime
catalog_product_entity_decimal
catalog_product_entity_gallery
catalog_product_entity_int
catalog_product_entity_media_gallery_value
catalog_product_entity_media_gallery_value_to_entity
catalog_product_entity_text
catalog_product_entity_tier_price
catalog_product_entity_varchar
catalog_product_frontend_action
catalog_product_index_tier_price
catalog_product_link
catalog_product_link
catalog_product_option
catalog_product_relation
catalog_product_relation
catalog_product_super_attribute
catalog_product_super_link
catalog_product_super_link
catalog_product_website
catalog_url_rewrite_product_category
cataloginventory_stock_item
downloadable_link
downloadable_sample
product_alert_price
product_alert_stock
report_compared_product_index
report_viewed_product_aggregated_daily
report_viewed_product_aggregated_monthly
report_viewed_product_aggregated_yearly
report_viewed_product_index
weee_tax
wishlist_item

enter image description here

But other tables on which product id save like sales_order does not delete, you will run delete query on catalog_product_entity

See: https://stackoverflow.com/questions/201621/how-do-i-see-all-foreign-keys-to-a-table-or-column

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.