Hi guys!
I work on a payment solutions module for Magento 2. We have a customer who is using this module on Magento Enterprise (Adobe Commerce), and this Magento version has the promotion scheduling feature (Catalog price rule):
Currently we are facing an issue related to this feature, because when scheduling a promotion for a product, the discount rule cannot be applied to the cart instantly at the scheduled time. The discount only starts to work a few hours later.
We use the calcProductPriceRule() method of the Magento\CatalogRule\Model\Rule class to get the price with the discount rule applied. We found that within this method, there is the use of Magento cache that could possibly be related to the problem:
https://github.com/magento/magento2/blob/2.4/app/code/Magento/CatalogRule/Model/Rule.php#L503.
I believe it is a problem related to the cache because as I mentioned, a few hours later the discount starts to work and can be applied to the cart normally.
Our customer has already run the commands such as bin/magento indexer:reindex and bin/magento cache:flush to try to clear the cache when creating the schedule, but it hasn't worked.
Does anyone please know if a specific command is needed to clear this specific cache variable? And then ideally we are going to add it to CRON.
Or some other idea of what might be going on?
Please check:
Read more documentation: Catalog price rule