How to get customer access token by id for REST api Magento 2?

Get Customer token for the REST API using customer id in Magento 2 used to call API.

If you have customer id, retrieve the token by the Token factory class of the Integration module.

Instantiate the Magento\Integration\Model\Oauth\TokenFactory in your class constructor method. Continue reading “How to get customer access token by id for REST api Magento 2?”

Use of Event catalog_category_change_products Magento 2.

Magento 2 uses catalog_category_change_products events to Checks if a category has changed products.

If you change an existing product from the category or adding new products to the category at that time, Magento use event for change products.

Declaration of the event from the vendor/magento/module-catalog/Model/ResourceModel/Category.php with a method, _saveCategoryProducts() that add logic for the Save category products relation. Continue reading “Use of Event catalog_category_change_products Magento 2.”

How to Reindex prices by product ids programmatically Magento 2?

You can reindex only prices for the products in the Magento 2 store by their IDs.

The indexer id used for the prices is catalog_product_price. We need to reindex only prices programmatically to reflect the price changes on the backend. you can do it using the CLI command also,

php bin/magento indexer:reindex catalog_product_price Continue reading “How to Reindex prices by product ids programmatically Magento 2?”