I have a product attribute inside Magento 2 with over 3.000 different values and, unfortunately, we cannot delete them. Right now they are only in English but they need to be translated in 8 different languages.

The translation part is not a problem. Importing the translation it is. All that copy and paste would take a ridiculous amount of time.

Is there a way to import in a faster way all the translated terms? Like, for example, exporting what is on M2 right now in CSV format, add the translations and import them again via CSV?

Thank you for any help you can provide :)

1 Answer 1


Magento doesn't provide any solution out of the box, but you can create simple script to update your translation in database directly.

Magento works with attribute options directly in resource model and doesn't provide any designed interface (logic) for work with them.

What you need to understand:

  1. Options stored in eav_attribute_option table.
  2. Option values stored in eav_attribute_option_value table.

What you need to do:

  1. Prepare some CSV file or just populate PHP array with Default name and Translated name

  2. Define attribute code (id) and store id

  3. Implement logic for load options like (better convert to select object):

    SELECT o.option_id, ovd.value as default_value, ovs.value_id, ovs.value as store_value FROM eav_attribute_option AS o
      INNER JOIN eav_attribute_option_value AS ovd ON ovd.option_id = o.option_id AND ovd.store_id = 0
      LEFT JOIN eav_attribute_option_value AS ovs ON ovs.option_id = o.option_id AND ovs.store_id = {$STORE_ID}
    WHERE o.attribute_id = {$ATTRIBUTE_ID};
  4. Match your translation with and insert or update (when value_id is present) into eav_attribute_option_value

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.