Need some help with your project? Contact me

How to translate Drupal Commerce products

This is a short tutorial on enabling Drupal Commerce product entities to be translated using the Entity Translation module in Commerce Kickstart.

As you know, Drupal can be quite frustrating at times when it comes to translation. You have some core stuff available that if coupled with some contrib solutions will get you going but it will never be perfect. At least not so easy. And if you are working with something as complex and custom as Drupal Commerce, things get more difficult, fast.

Today I want to share with you my experience with enabling product entities to be translated with Entity Translation in the Commerce Kickstart distro. Let's say your Product Displays are translatable already (either using core and the i18n package or with Entity Translation) but the products are not. What do you do?

Well first you need to go to admin/config/regional/entity_translation and enable Commerce Product under the Translatable Entities list. Then - and if you've been searching the internets and reached here desperate for a solution - you have to edit the product type you want translatable (at admin/commerce/products/types) and check the radio Enabled via Entity translation. You know, like with regular content types.

But wait a minute. There is no such thing. You are seeing nowhere product types and this URL throws a 404 error. There are product variations, but no multilingual options when you edit product variation types. So wtf is going? You are using Commerce Kickstart - that's what's going on. And Commerce Kickstart comes with Commerce Backoffice that for ease of use and whatnot removes the product type UI and replaces it with product variations - among other things of course.

So what do you do? Go ahead and disable the module Commerce Backoffice Product. Clear the cache. Then go back to that URL (admin/commerce/products/types), edit the product type you want (remember, the product type is the variation you had before) and you will find upon that multilingual setting you couldn't find. Save the product type and your product entities of that type are now translatable.

You can then edit the individual fields on the product type/variation and enable translation. And this includes the title as well if you are using the Title module (which Commerce Kickstart should). This was in fact my need. The product displays where translated but the product entity titles were not. So in my cart, the line items were referencing the product entity title and not that of the display. Translating the product entity title therefore solved my problem.

Now if you want to go back to the way it was - using product variations and the old UI - which I prefered actually, re-enable the Commerce Backoffice Product module and clear the cache a couple of times. I had to wait a bit before everything reverted properly, but it did nonetheless. So if you don't get back your variations instantly, don't fret, they'll come soon.

OK, so hope this helps.

Comments

Danny would love to introduce you to the Lingotek Translation module. It is a super easy way to configure translation in Drupal and in fact we are bundled in the Commerce Kickstart distribution. We enable you to translate content in real time with machine translation integration or you can translate the pages yourself. You can also use our professional translation services group if you need help with that as well. You can learn more here https://drupal.org/project/lingotek

Really detailed and useful explanation on translate in drupal. Thanks.

kickstart 2.12, entity translation and i18n modules enabled.
All seems to work preliminary, except translating taxanomy term.
I checked taxonomy term under entity translation, but when I tried to translate taxonomy term, it said " no translatable fields". Tried enabling taxonomy translation module. No help.
The only work around so far is menu translation. However, I still have 2 places where term is not translated? http://i60.tinypic.com/2v80m6s.jpg Any idea why " no translatable fields" . And how to resolve the 2 places where term is not translated?

One other question:
how to translate image alt and title fields? I already enable translation with Images under Product Variation/Manage Fields.

Hi! If you're interested in translating Drupal, have a look at the online translation platform https://poeditor.com/
It's one of the best software localizaiton solutions out there.

Titles are working correctly. But not the bodies...

"Now if you want to go back to the way it was - using product variations and the old UI - which I prefered actually, re-enable the Commerce Backoffice Product module and clear the cache a couple of times. I had to wait a bit before everything reverted properly, but it did nonetheless. So if you don't get back your variations instantly, don't fret, they'll come soon. - See more at: http://www.webomelette.com/translate-drupal-commerce-product-entities-ty..."

I LOVE YOU :-) MANY THANKS!!!!

No problem,

Glad I could help :)

Also you can try to use the follow module: https://www.drupal.org/project/i18n_commerce_product

Thanks, this just totally saved my life after searching Google for hours... and even posting about it for the first time ever on a blog (http://freshpure.tumblr.com/). Dmitry's i18n_commerce_product did not work either.

Does this mean that I will need to enable/disable the "Commerce Backoffice Product" each time I need to translate?

Add new comment

You can post comments in Markdown and basic HTML tags.
For code blocks, wrap your code within '~~~'. For example:
~~~
$var = 'my variable';
~~~