Clean cache for categories on stock change for variants #281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem: If is_in_stock on a simple product is changed. The category where the parent (configurable product) isn't cleaned.
This will result in too many or too few products showing when filtering on the category pages, when layered navigation is enabled.
An example is:
You sell shoes and have filter on size. The filter show that you have 2 left in size 39. If the simple product is set to not in stock. The categories cache will not be cleaned, and the filter will still show 2 left in size 39, but when you enter the product page the expected size is not available.
The same seems to be the issue if you have a shoe in size 39 that is out of stock, and you get it back into stock. Then this will not show up in the filter until you have cleaned the cache.
This patch will fix both these scenarios by cleaning category cache for all categories where the parent product is located.