I work on Magento 2.4 and I’d like to enable programmatically for selected products “Manage Stock” option and set status Out Of stock. Like here:
But I did not found how it should be done in Magento higher than 2.4 I found that MagentoCatalogInventoryApiStockRegistryInterface is deprecated. Product model setStocData() also is deprecated.
How it should be done without use of any deprecated classes?