I am trying to edit configurable product and getting error. I am using Magento version 2.1.2

Steps to reproduce:

  1. Go to admin -> Stores -> Configuration -> Sales -> Google API section

  2. Change the configuration Enable Content Experiments to "Yes"

  3. Save a configurable product and its child product consecutively.

Expected result:

  1. Product should be save successfully with any number of times.

Actual result:

  1. failed to save product

  2. getting bellow error:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0-402-product' for key 'GOOGLEOPTIMIZER_CODE_STORE_ID_ENTITY_ID_ENTITY_TYPE', query was: UPDATE googleoptimizer_code SET entity_id = ? WHERE (code_id='136')

Anyone can help me to fix this issue?


I found the solution. To fix this issue I edit configurations options and its worked for me. please refer this link http://prntscr.com/e7px78


If you don't use google experiments you can just truncate googleoptimizer_code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.