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.
Happy Fixing!