Home › Forums › WoodMart support forum › Variation Gallery and Swatch Not Working With WPML
Variation Gallery and Swatch Not Working With WPML
- This topic has 7 replies, 2 voices, and was last updated 12 hours, 11 minutes ago by
Luke Nielsen.
-
AuthorPosts
-
April 14, 2025 at 3:55 pm #653914
jimmy.xuppParticipantHi,
After I translated the product via WPML, both varation gallery and swatch are not working, can you take a look?
Here is the link: https://www.peilishop.com/fr/produit/echarpe-en-cachemire-a-rayures-kyla/
Best,
JimmyApril 14, 2025 at 5:42 pm #653955
Luke NielsenKeymasterHello,
You should be able to translate product variations from WooCommerce > WooCommerce Multilingual > Attributes tab and after that, you need to press the Synchronize attributes and update product variations button, please make sure to take a backup of your site first for security reasons.
Here is a doc for more details:
https://wpml.org/documentation/related-projects/woocommerce-multilingual/#variationsKind Regards
April 15, 2025 at 6:39 am #654043
jimmy.xuppParticipantI fixed the swatch issue, but the variation gallery is not working, when I clicked the swatches, only the featured image is changed, but the of the gallery images are not.
Here is what the product should look like: https://www.peilishop.com/product/kyla-stripe-cashmere-scarf/
How should I fix it?
April 15, 2025 at 11:54 am #654172
Luke NielsenKeymasterHello,
Currently, it changes, here is a video – https://dropmefiles.com.ua/en/9e3GKWAk
Let me know if you have sorted it out.
Kind Regards
April 15, 2025 at 5:28 pm #654369
jimmy.xuppParticipantYes, the original product in English is working well, but it’s not working in translated language, https://www.peilishop.com/fr/produit/echarpe-en-cachemire-a-rayures-kyla/
How should I make it work? Hope you understand what I mean.
April 16, 2025 at 10:11 am #654507
Luke NielsenKeymasterHello,
Okay, I see. May I disable 3rd party plugins for testing?
I await your response.
Kind Regards
April 17, 2025 at 6:44 am #654794
jimmy.xuppParticipantPlease test on this staging site: https://wordpress-1447784-5427290.cloudwaysapps.com/
Same login credential as the live site.
April 18, 2025 at 3:55 pm #655266
Luke NielsenKeymasterHello,
Add the code below to the child theme and recheck the issue:
add_action('init', function () { remove_filter( 'woocommerce_available_variation', 'woodmart_avi_update_available_variation', 10, 3 ); }); function wd_avi_update_available_variation( $available_variation, $variation_object, $variation ) { if ( ! woodmart_get_opt( 'variation_gallery' ) ) { return $available_variation; } $product_id = $variation->get_parent_id(); $default_images_data = woodmart_avi_get_default_data( $product_id ); $variation_id = apply_filters( 'wpml_object_id', $available_variation['variation_id'], 'product_variation', true ); $images_data = get_post_meta( $variation_id, 'wd_additional_variation_images_data', true ); $ids = array_filter( explode( ',', $images_data ) ); if ( has_post_thumbnail( $variation_id ) ) { $available_variation['additional_variation_images'][] = woodmart_avi_get_image_data( get_post_thumbnail_id( $variation_id ), true ); } foreach ( $ids as $id ) { $available_variation['additional_variation_images'][] = woodmart_avi_get_image_data( $id ); } if ( $default_images_data ) { $available_variation['additional_variation_images_default'] = $default_images_data; } return $available_variation; } add_filter( 'woocommerce_available_variation', 'wd_avi_update_available_variation', 10, 3 );
Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register