탐색 건너뛰기

Waiting for author

Topic Tags: Compatibility

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:
    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.

답장을 남겨주세요

주제를 유지하고 다른 사람을 존중하십시오. 이 게시물과 관련 없는 문제에 대한 도움이 필요한 경우 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하십시오.

다음 태그를 사용할 수 있습니다.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>