Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

reindex after post api magento 2

$objectManager = MagentoFrameworkAppObjectManager::getInstance();
    $indexerCollectionFactory = $objectManager->get("MagentoIndexerModelIndexerCollectionFactory");
    $indexerFactory = $objectManager->get("MagentoIndexerModelIndexerFactory");

    $indexerCollection = $indexerCollectionFactory->create();
    $allIds = $indexerCollection->getAllIds();
    foreach ($allIds as $id) {
        $indexer = $indexerFactory->create()->load($id);
        $indexer->reindexAll();
    }
Source by magento.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #reindex #post #api #magento
ADD COMMENT
Topic
Name
6+4 =