v1.1.0: Fix the issue cannot save catalog rule on M2.3.4

Created by Rosa Truong, Modified on Wed, 14 Apr 2021 at 01:47 PM by Rosa Truong


We have used module version 1.1.0 on M2.3.4 CE. When testing on the backend, we cannot save the  catalog rule and got this error:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`stgdb`.`catalogrule_website`, CONSTRAINT `CATALOGRULE_WEBSITE_ROW_ID_CATALOGRULE_ROW_ID` FOREIGN KEY (`row_id`) REFERENCES `catalogrule` (`row_id`) ON DELETE CASCADE), query was: INSERT  INTO `catalogrule_website` (`website_id`,`row_id`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `row_id` = VALUES(`row_id`)

Please check and give us the solution.


First, we would like to confirm that when your Magento version is M2.3.4, please use our module version 1.0.9 since this version works well on M2.3.4 at this time.

In case you still want to use version 1.1.0 on M2.3.4, we would like to give the hot-fix solution as below.

+ Add this file 


+ Apply the new code on the site and flush the cache.

If you need any further assistance, please feel free to contact us.

We're more than happy to support you.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article