This thread is resolved. Here is a description of the problem and solution.
Problem: If you're experiencing issues with the video function in your product not working, we have identified a solution. Solution: We recommend adding the following code into the
add_filter('get_post_metadata', 'wpml_compsupp7477_filter_woodmart_wc_video_gallery', 10, 4);
add_filter('woodmart_single_product_image_thumbnail_id', 'wpml_compsupp7477_translate_attachment_id', 10, 2);
function wpml_compsupp7477_filter_woodmart_wc_video_gallery($null, $object_id, $meta_key, $single) {
// Target the specific meta key
if ($meta_key !== 'woodmart_wc_video_gallery') {
return $null;
}
// Prevent recursion by temporarily removing the filter
remove_filter('get_post_metadata', 'wpml_compsupp7477_filter_woodmart_wc_video_gallery', 10);
// Fetch the original meta value
$video_gallery = get_post_meta($object_id, $meta_key, false);
// Re-add the filter
add_filter('get_post_metadata', 'wpml_compsupp7477_filter_woodmart_wc_video_gallery', 10, 4);
// Check if we actually got an array
if (isset($video_gallery[0]) && is_array($video_gallery[0])) {
foreach ($video_gallery[0] as $key => $value) {
// Apply the WPML filter to each item (video settings array key)
$translated_key = apply_filters('wpml_object_id', $key, 'post', true);
$video_gallery[0][$translated_key] = $value;
}
}
return $video_gallery;
}
function wpml_compsupp7477_translate_attachment_id($attachment_id, $product) {
return apply_filters('wpml_object_id', $attachment_id, get_post_type($attachment_id), true);
}
Please ensure to backup your database before implementing this code.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your specific case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at WPML support forum.
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.
Our next available supporter will start replying to tickets in about 6.03 hours from now. Thank you for your understanding.
Background of the issue:
Hello, after upgrading WPML, Woodmart theme, and WordPress, the video function in the product is not working. If I disable WPML CMS, then it works normally.
Symptoms:
The video function in the product is not working after upgrading WPML, Woodmart theme, and WordPress. It works normally when WPML CMS is disabled.
Questions:
Why is the video function in the product not working after upgrading WPML, Woodmart theme, and WordPress?
How can I fix the video function issue without disabling WPML CMS?
Does it happen with all languages or only with translations?
You mentioned that it works if you disable WPML. What are the results if you turn off all plugins except WPML, WooCommerce Multilingual & Multicurrency?
hello and thank you for your answer, I did some tests to see if it happens in all languages and I noticed that in the main language (in my case Greek) the video works, while in the second language (in my case English) it doesn't the video appears
The theme feature probably has a custom field responsible for the video settings, and it may not have been carried over to the translated products. This custom field might be called "woodmart_wc_video_gallery." Please try setting this custom field as "Copy" in WPML → Settings → Custom fields and then update the products. To update the products, you can modify the original product, save it, go to the WPML translation editor, and complete the translation.
hi I did the steps you mentioned, but when I try setting this custom field as "Copy" in WPML → Settings → Custom fields and then update the products. the video does not appear in any language, neither in Greek (main language) nor in English
I need to request temporary access (wp-admin and FTP) to your site – preferably to a test site where the problem has been replicated if possible – in order to be of better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Please provide the link to the product that works for the original language but not for the secondary language.
hello, this is not the fault because on the real website your plugin is updated to the latest version, but it still doesn't work, can you find a solution to my problem without wasting time on useless messages? the response is taking too long.
I appreciate your patience. I have conducted further testing on this issue and have discovered that the product video feature of this theme does not work if the product was not initially created in the default language of the site.
Here's what I did:
1) I used the product you shared as an example, went to the translation section, and re-linked the product, choosing Greek as the original product language.
I cannot double-check because your staging site isn't available anymore. I have already reported this issue to our compatibility team. For this feature to work, the product needs to be created in the site's default language first.
the website is accessible normally, this website was originally made in English about 3 years ago, this year we decided to make it in Greek and we set Greek as the main language for this and we bought your plugin, so all the products were originally made with the English language, as you understand it is not logical and normal that I have to edit all the products one by one for the video to appear