Deleting website doesn't delete entry from inventory_stock_sales_channel
- Dominant language
- PHP
- Stars
- 357
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
Magento 2.3.5-p2
needs to be verified in 2.3.6-p1 and 2.4.x as well.
Table uses website code instead of website_id, no foreign key available.
If you delete a website which is assigned to a stock (admin/inventory/stock/edit/stock_id/1)
1. the stock overview breaks
2. product details are missing on frontend
3. product widget preview (in page builder) breaks.
Reason: There are entries (website_codes) in the inventory_stock_sales_channel table which the resolver tries to load from the store_website table. Those entries don't exists there -> exception :-)
I recommend to add a FK and a new column "website_id" to delete entries from inventory_stock_sales_channel, when the corresponding website is deleted.
Contributor guide
Research direction
Start by reproducing website deletion with a stock assigned through admin/inventory/stock/edit/stock_id/1, then inspect inventory_stock_sales_channel and its lookup against store_website. Verify the behavior in the listed Magento versions. Done means deleting a website removes its related inventory entries and the stock overview, product details, and Page Builder widget preview no longer fail.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100