I am unable to add any translations to my product variation, however the ProductVariation entity class has an annotation of translatable = True.

Is this a bug or am i missing somthing here?

Comments

powysm created an issue. See original summary.

bojanz’s picture

We need to fix IEF first #2494959: Add translation integration. The ideal UX is for variations to be translated when the main product is translated.

agoradesign’s picture

@powysm

The reason, why the one entity type is acknowledged as translatable but the other not, is that product entities have a canonical link template, variations not. Theses entity types must set 'content_translation_ui_skip' TRUE in order to be translatable too. read more at https://api.drupal.org/api/drupal/core%21modules%21content_translation%2...

agoradesign’s picture

imho it does make sense to enable translations, even before IEF is fixed. E.g. I'm importing all products from XML. It's more important to me to have a working import than a working UI.

Additionally, #2494959: Add translation integration does contain a working patch, that can be used in the meantime.

For everyone, that want to enable the translations of variations, here's a workaround that does not need a patch to Commerce files. Just implement the following function in a custom module:

function YOURMODULE_entity_type_alter(array &$entity_types) {
  if (isset($entity_types['commerce_product_variation'])) {
    $entity_types['commerce_product_variation']->set('content_translation_ui_skip', TRUE);
  }
}
bojanz’s picture

Title: Product variation - Translation is not supported » Implement translation support for products and variations
Version: 8.x-2.0-alpha1 » 8.x-2.x-dev
Category: Bug report » Task
Issue tags: -product variation, -product, -translate

The IEF issue is done.

Time to implement the Commerce side:

1) content_translation_ui_skip on the variation annotation
2) make the SKU non-translatable
3) Add code that ensures the product variations are loaded in the same language as the product itself. Same with stores, for consistency.

  • bojanz committed ec6932c on 8.x-2.x
    Issue #2647736 by bojanz, agoradesign: Implement translation support for...
bojanz’s picture

Status: Active » Fixed

Welcome to the shiny, translatable future :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.