Magento 2 Product Price Reindex Programmatically

In this article, you going to discuss regarding Magento 2 Product Price Reindex Programmatically in depth and step by step.

If you are looking for this topic then you are right place.

Let’s start with the topic of Magento 2 Product Price Reindex Programmatically

It is very simple to do reindex only product price in Magento 2.

Indexer called catalog_product_price ids used for prices.

Using programmatically indexing for only catalog product price and changes reflect in the backend section.

Using CLI command can also do only re-index catalog product price.

php bin/magento indexer:reindex catalog_product_price

Below is code snippet for reindex catalog product price.

namespace Techone\PriceIndexer\PathToModel;

use Magento\Catalog\Model\Indexer\Product\Price\Processor as PriceIndexerProcessor;

class PriceIndexer
     * @var PriceIndexerProcessor
    private $priceIndexProcessor;

    public function __construct(
        PriceIndexerProcessor $priceIndexProcessor
    ) {
        $this->priceIndexProcessor = $priceIndexProcessor;

     * reindex price
     * @param array $productId
     * @return void
    public function reindexPrice(array $productId)
        return $this->priceIndexProcessor->reindexList($productId);

The main role for reindex for only catalog price done by class file.

Below is path for the class file.


Using this class file in method called reindexList method product id passed.

This class file play an important role in this re-indexing process for product price.

Due to which re-indexing process for catalog price is achieved.

By calling above method re-indexing process for catalog price by passing id is done.

$productIds = [4,5,6];

Magento 2 Disable Payment Method Programmatically

Conclusion :

Using above code snippet you understand regarding Product Price Reindex Programmatically.

I hope you like this article and if you have any query, please comment below.

Leave a Comment