cancel
Showing results for 
Search instead for 
Did you mean: 

Catalog price rule promotion schedule not working instantaneously

Catalog price rule promotion schedule not working instantaneously

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): 

(https://docs.magento.com/user-guide/marketing/price-rule-catalog-scheduled-changes.html#schedule-an-...). 

 

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?

1 REPLY 1

Re: Catalog price rule promotion schedule not working instantaneously

Please check:

  1. Is the rule active?
  2. Has the rule been applied?
  3. Is the rule active on this day?
  4. Does the rule you created actually include the targeted products?
  5. Does your rule not applied because of priority? If all of above are working then your rule will be visible to front ent when once your cron will run and once page cache will be flushed

SX4eE.png

Read more documentation: Catalog price rule