Use SaaS Price Indexing
SaaS price indexing is enabled automatically when you install Adobe Commerce Services. It supports price calculation for all built-in Adobe Commerce product types.
Requirements
- Adobe Commerce 2.4.4+
Prerequisites
-
One of the following Commerce Services must be installed with the latest version of the Commerce extension:
Synchronize prices with SaaS price indexing
After enabling SaaS price indexing for Adobe Commerce, update prices on the Storefront and in Commerce Services by synchronizing the new feeds:
bin/magento saas:resync --feed=scopesCustomerGroup
bin/magento saas:resync --feed=scopesWebsite
bin/magento saas:resync --feed=prices
Prices for custom product types
Price calculations are supported for custom product types such as base price, special price, group price, catalog rule price, and so on.
If you have a custom product type that uses a specific formula to calculate the final price, you can extend the behavior of the product price feed.
-
Create a plugin on the
Magento\ProductPriceDataExporter\Model\Provider\ProductPrice
class.<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ProductPriceDataExporter\Model\Provider\ProductPrice"> <plugin name="custom_type_price_feed" type="YourModule\CustomProductType\Plugin\UpdatePriceFromFeed" /> </type> </config>
-
Create a method with the custom formula:
class UpdatePriceFromFeed { /** * @param ProductPrice $subject * @param array $result * @param array $values * * @return array */ public function afterGet(ProductPrice $subject, array $result, array $values) : array { // Override the output $result with your data for the corresponding products (see original method for details) return $result; } }