How to fix error couldn't save product "2439" with position 30 to category 442 ( if you installed Dynamic categories from Miravsit )?

If you have this error when saving product:

couldn't save product "2439" with position 30 to category 442

 

And in logs you may have this:

[2023-01-16 08:34:52] main.CRITICAL: Could not save product "2146" with position 0 to category 424 {"exception":"[object] (Magento\\Framework\\Exception\\CouldNotSaveException(code: 0): Could not save product \"2146\" with position 0 to category 424 at /var/www/goaskle/data/www/www.goaskle.com/vendor/magento/module-catalog/Model/CategoryLinkRepository.php:49, Magento\\Framework\\Exception\\AlreadyExistsException(code: 0): Unique constraint violation found at /var/www/goaskle/data/www/www.goaskle.com/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php:431, Magento\\Framework\\DB\\Adapter\\DuplicateException(code: 1062): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5-424-category' for key 'GOOGLEOPTIMIZER_CODE_STORE_ID_ENTITY_ID_ENTITY_TYPE', query was: UPDATE `googleoptimizer_code` SET `entity_id` = ?, `entity_type` = ?, `store_id` = ? WHERE (code_id=2152) at /var/www/goaskle/data/www/www.goaskle.com/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:585, Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5-424-category' for key 'GOOGLEOPTIMIZER_CODE_STORE_ID_ENTITY_ID_ENTITY_TYPE', query was: UPDATE `googleoptimizer_code` SET `entity_id` = ?, `entity_type` = ?, `store_id` = ? WHERE (code_id=2152) at /var/www/goaskle/data/www/www.goaskle.com/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:110, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5-424-category' for key 'GOOGLEOPTIMIZER_CODE_STORE_ID_ENTITY_ID_ENTITY_TYPE' at /var/www/goaskle/data/www/www.goaskle.com/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91)"} []

 

Then just go to magento 2 settings:

On the Admin sidebar, go to Stores > Settings > Configuration. In the left panel, expand Sales and choose Google API.

You will see Google Google Analytics section

Just DISABLE there this line ( SET TO NO ):

Enable Content Experiments

 

Now you error is fixed