This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by danielB-141 2 months, 2 weeks ago.

Assigned support staff: Itamar.

Author Posts
July 31, 2019 at 9:21 am #4313261

danielB-141

Hello everybody,

we use WPML with the WooCommerce REST API and wanna add some translated products. Everything works fine, but we don't know how to use the duplicated product images via the API. The original product has some images which are duplicated in all other languages while import.

If we import the translations without an image array, the translated images are not used.
If we import the translations with an image array, the images are imported again.
Is there any way to just use the duplicated images from the original products?

$prod_EN[] = array(
'name' => $prodrs['OXTITLE_1'],
'export' => $prodrs['OXEXPORT'],
'description' => $prodrs['OXLONGDESC_1'],
'short_description' => $prodrs['OXSHORTDESC_1'],
'oxid_id' => $prodrs['OXID'],
'menu_order' => $prodrs['OXSORT'],
'active' => $prodrs['OXACTIVE'],
'sku' => $prodrs['OXARTNUM'],
'meta_data' => [
[
'key' => '_oxid_id',
'value' => $prodrs['OXID']
]
],
'images' => $images,
'lang' => 'en',
'translation_of' => $trans,
);

Thanks, Daniel

July 31, 2019 at 1:55 pm #4314917

danielB-141

My issue is resolved now. Thank you!

July 31, 2019 at 2:05 pm #4315151

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I'm sorry, but if you do not include the image in the import of the translation, WPML will not be able to assign the correct image to this product. Currently, I see no other way that this could work but by adding the code for the image.
Does this make your work more complicated?

Regards,
Itamar.

July 31, 2019 at 2:23 pm #4315245

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Great, I'm glad that it is solved now!

Good luck with your web projects 🙂
Itamar.

July 31, 2019 at 2:24 pm #4315273

danielB-141

Thx 🙂