Delete website in Magento can't delete store and store view

Delete website in Magento can't delete store and store view

July 24, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Delete website in Magento can't delete store and store view

Understanding the Magento Delete Website Issue

As a senior developer working on e-commerce platforms like Magento, I often encounter complex issues related to store management. One common problem faced by many developers involves deleting websites in Magento - specifically when you’re unable to delete a store and its corresponding views.

The Problem at Hand

You’ve shared your custom deleteWebsitePostAction() method which extends the default Magento functionality for deleting websites. This function appears to be correctly handling most aspects of the deletion process, including database operations and file system cleanup. However, despite having this overwritten action in place, you’re still encountering an issue where a website cannot be deleted.

Potential Reasons for the Issue

There could be several reasons why this error persists even after implementing a custom delete function:

  1. Database Consistency: Magento maintains complex inter-relationships between tables like core_website, core_store_group, and core_store. If there are orphaned records or inconsistencies in these tables (e.g., a store view linked to a non-existent website), it could prevent the deletion process.

  2. System Configuration: The system configuration setting for multi-web functionality might be incorrectly set, which can lead to unexpected behavior during deletion. Ensure that web/multi_web_general/multi_web is configured appropriately.

  3. Custom Extensions: If you have installed any third-party extensions or custom code in your Magento installation, these might interfere with the core delete process. They could be hooking into the same events or overwriting other parts of the deletion logic.

  4. Permission Issues: In some cases, file permissions on the server level can prevent the deletion of directories and files. Ensure that your web server has sufficient write permissions for the Magento installation directory.

Steps to Troubleshoot

To resolve this issue effectively, I recommend following these troubleshooting steps:

  1. Check Database Consistency: Use a database management tool like phpMyAdmin or MySQL Workbench to examine the core_website, core_store_group, and core_store tables directly. Look for any records that reference the website you’re trying to delete but appear to be orphaned.

  2. Disable Extensions: Temporarily disable all third-party extensions in your Magento installation to rule out any conflicts caused by external code. You can do this via the Magento backend’s “System” > “Configuration” > “Advanced” menu.

  3. Review System Configuration: Ensure that your system configuration settings, especially those related to multi-web functionality, are configured correctly under “System” > “Configuration” > “Web”.

  4. Check File Permissions: Use a tool like SCP or the Linux command line in your hosting environment to check and adjust file permissions for the Magento installation directory.

Conclusion

Deleting websites in Magento can be complex due to its multi-tiered store structure. While you’ve implemented a comprehensive custom delete function, it appears that there are still underlying issues preventing the deletion process from completing successfully.

I recommend thoroughly checking your database relationships, reviewing system configurations, and examining potential conflicts with third-party extensions or file permissions. Remember to always backup your data before making structural changes in Magento.

For more detailed guidance on Magento development best practices and troubleshooting techniques, I encourage you to explore the extensive resources available at Laravel Company. Their expert articles and tutorials provide valuable insights into managing complex e-commerce projects effectively.

Database Extensions Configuration Errors

Our network