Waiting for author
Overview of the issue
If you are using Woodmart theme in conjunction with WPML, you may encounter an issue where translating a Product Layout get stuck and do not complete. Furthermore, you will find a similar error:
Call to a member function get_gallery_image_ids() on null .../wp-content/themes/woodmart/woocommerce/single-product/product-image.php:27
Workaround
Please, make sure of having a full site backup of your site before proceeding.
- Open your theme’s functions.php file.
- Add the following snippet:
123456789101112131415161718192021
add_action(
'woocommerce_before_template_part'
,
function
() {
global
$product
;
if
( wp_is_json_request() && !
$product
) {
$random_product
=
new
WP_Query(
array
(
'posts_per_page'
=>
'1'
,
'post_type'
=>
'product'
,
)
);
while
(
$random_product
->have_posts() ) {
$random_product
->the_post();
$product_id
= get_the_ID();
}
wp_reset_postdata();
$product
= wc_get_product(
$product_id
);
}
} );
- Clear your cache and retranslate your product layout.
Update: WoodMart team was also a patch available and it should be fix in their next update.
- Go to WordPress Dashboard -> WoodMart -> Patcher.
- Select Patch number 618307.