---
title: "How to Magento 2 Reindex one Product Programmatically?"
url: "https://dolphinwebsolution.com/how-to-magento-2-reindex-one-product-programmatically"
date: "2021-04-01T04:23:58+05:30"
modified: "2023-08-24T09:43:45+05:30"
author:
  name: "Jigar Patel"
categories:
  - "Magento"
word_count: 258
reading_time: "2 min read"
summary: "In this article we will learn how to Magento 2 Reindex one Product Programmatically. Indexer is the most important feature in Magento 2 Indexing.

For example, if more items and you change the pr..."
description: "In this article we will learn how to Magento 2 Reindex one Product Programmatically. Indexer is the most important feature in Magento 2 Indexing."
keywords: "Magento 2 Reindex one Product Programmatically,Magento 2 Reindex Programmatically,Reindex one Product Programmatically,Reindex Programmatically in magento 2,Magento Reindex one Product Programmatically,Magento Reindex Programmatically,Reindexes automatically, Magento"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How To Add Or Create Slide-out(Sliding) ,Modal Windows Panels in Magento 2"
    url: "https://dolphinwebsolution.com/how-to-add-or-create-slide-outsliding-modal-windows-panels-in-magento-2"
  - title: "How To Change Responsive Breakpoint and Viewport in Magento 2"
    url: "https://dolphinwebsolution.com/change-breakpoint-and-viewport-in-magento-2"
  - title: "Why Seek the Services of Magento Solution Specialists for Your Project?"
    url: "https://dolphinwebsolution.com/services-of-magento-solution-specialists-for-your-project"
---

# How to Magento 2 Reindex one Product Programmatically?

_Published: April 1, 2021_  
_Author: Jigar Patel_  

![](https://dolphinwebsolution.com/wp-content/uploads/2023/02/Reindex-1024x512.jpg)

In this article we will learn how to **Magento 2 Reindex one Product Programmatically**. Indexer is the most important feature in Magento 2 [Indexing](https://dolphinwebsolution.com/magento-how-to-implement-custom-indexing-within-flash-time).
For example, if more items and you change the price of a single item from $8.99 to $6.99. Magento must reindex the price change to display it on your storefront.
Reindexes automatically whenever one or more items change. Actions that trigger reindexing include price changes, creating [catalog](https://dolphinwebsolution.com/shop/magento-2-extensions/catalog.html) or shopping cart price rules, adding new categories, and so on. To optimize performance, Magento accumulates data into special tables using indexers. As the data changes, the indexed tables must be updated—or reindexed. [Magento reindexes](https://devdocs.magento.com/guides/v2.4/config-guide/cli/config-cli-subcommands-index.html) as a background process, and your store remains accessible during the processesCreate**singleItemReindex`.php`** at **`/pub/singleItemReindex.php`**

```
<?php
use Magento\Framework\App\Bootstrap;

require '../app/bootstrap.php';
ini_set('display_errors', 1);

$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$childIds = $objectManager->get('Magento\ConfigurableProduct\Model\Product\Type\Configurable')->getChildrenIds('371009');//get configurable child item
$productIds = $childIds[0];

//$productIds = ['25206']; //pass product id
//list of indexers
$indexLists = ['catalog_category_product', 'catalog_product_category', 'catalog_product_attribute', 'cataloginventory_stock', 'inventory', 'catalogsearch_fulltext', 'catalog_product_price', 'catalogrule_product', 'catalogrule_rule'];

foreach ($indexLists as $indexList) {
    $categoryIndexer = $objectManager->get('Magento\Framework\Indexer\IndexerRegistry')->get($indexList);

    if (!$categoryIndexer->isScheduled()) {
    try {
        $categoryIndexer->reindexList(array_unique($productIds));
        echo $indexList . '<br>';
    } catch (\Exception $e) {
        echo $e->getMessage();
    }
    }
}
```


---

_View the original post at: [https://dolphinwebsolution.com/how-to-magento-2-reindex-one-product-programmatically](https://dolphinwebsolution.com/how-to-magento-2-reindex-one-product-programmatically)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-26 06:54:01 UTC_  
