Categories: How ToMagento 2

How to fix “Unique constraint violation found” in Magento 2 Checkout Page After Migration

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!

Click to rate this post!
[Total: 10 Average: 5]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate 🎖️ Certified Magento Developer👨‍💻. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.🏏

View Comments

  • 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.

  • 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.

    Regards

Recent Posts

How to Delete Product Variant in a Shopify Remix App using GraphQL Mutations?

Managing a Shopify store efficiently involves keeping your product catalog organized. This includes removing outdated…

6 hours ago

6 Innovative Tools Revolutionizing E-Commerce Operations

E-commerce has transformed the way consumers shop for products and services and interact with businesses.…

3 days ago

How Upcoming Cookie Changes Will Affect Your E-commerce Website?

The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…

3 days ago

Magento 2: How to Add Header and Footer in Checkout

Hello Magento Friends, In today’s blog, we will discuss adding a header and footer to…

3 days ago

Understanding Flexbox Layout in React Native

Hello React Native Friends, Building a visually appealing and responsive mobile app is crucial in…

5 days ago

HYVÄ Themes Releases: 1.3.6 & 1.3.7 – What’s New

We have brought exciting news for Magento store owners. Hyvä Themes recently released 1.3.6 and…

5 days ago