Disabling or hiding configurable products on multi-store
Magento v. 22.214.171.124
The scenario is:
- multi-store (10+ countries)
- products for each store have their own stock (one or more warehouses)
What I do is go over every store and if there is no stock for any of the child products in any of the warehouses for that store I set the 'visibility' attribute on the configurable product for that store to 'not visible individually' (works the other way around also if stock goes up after sync from external system).
The desired result is that any product that is not in stock for that specific store is not available in catalog, search. I can't just disable the product because that is a global setting.
The code as far as inserting/updating 'visibility' attribute is working fine. But Magento still displays the product on the frontend even though it's set as 'not visible individually' (reindex & cache flush don't help).
it doesn't work even if I set everything manually so it is not a problem in my code as far as I can tell ...
Setting to 'not visible individually' should exclude the product from catalog, search ... right?