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 Magento 2 store by their ids.

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 CLI command also,
php bin/magento indexer:reindex catalog_product_price Continue reading “How to Reindex prices by product ids programmatically Magento 2?”

How to get tier price by Product SKU Magento 2?

Get Tier price by SKU or Product id in Magento 2 with TierPrice Storage Interface.

Magento\Catalog\Api\TierPriceStorageInterface used to retrieve the tier price of a product. get(array $sku) method with an array of product SKU as argument returns pricing information for the specified product.

You can retrieve the tier price of the single product or multiple products by their SKU as comma-separated. Just refer the code snippet to get tier price, Continue reading “How to get tier price by Product SKU Magento 2?”