Magento 2 uses new approaches with new and enhanced design, and database that gives store owners to enhance their shopping experiences, increase security & functionality compared to Magento 1. Out of the box, Magento 2 comes with new user interface along with the capability of handling a large amount of data. To take advantage of these features and capabilities, Magento Store owners are migrating their existing store to feature pack Magento2 at a rate of knots. Migrating existing Magento store without losing data is one of the trickiest and the complex processes that need an attention and care to smoothly migrate your store. Recently, while upgrading a client’s web store, we faced an issue of “Unique constraint violation found” at product checkout in Magento 2 as shown below.
After mining the reason behind this issue, we found that to fix this issue, we have to manually add some entries to the database. We need to add ‘meta_id’ manually in ‘sales_sequence_profile’ table which defines in ‘sales_sequence_meta’ of a database as described below.
First of all, we need to add ‘meta id’ to ‘sales_sequence_meta’ table.
After adding ‘meta id’ to ‘sales_sequence_meta’ table, you need to add those ‘meta id’ to ‘profile id’ into existing ‘sales_sequence_profile’ table and additionally, we have to add more entry in ‘prefix’ column.
Once you are done, now you are unstoppable. Just clear the cache and your issue of “Unique Constraint Violation Found” is resolved.
Generally, we have noticed that the issue occurs while migrating a Magento store to 2.1.0 or later versions. Let me know with which Magento 2 version you are trying this code and also let me know in the comment section, if you are facing any issue while implementing this method.
I have faced an issue when I upgraded the Magento 2 version 2.3.2 to 2.3.7 then faced that issue. And ‘sales_sequence_meta’ & ‘sales_sequence_profile’ Table already added value as per you solution. But facing same error.
I only have a store 1… no store 2 so would I add Sequence for “2” like you did?
This worked much thanks!
Hey Dhiren ,
I have same problem and I am trying to do your solution but the problem is that I dont have any store with id 2 so would it work if there is no store with id 2.
I have this problem in my store now
Yes above solution should work.