Bỏ qua điều hướng

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.

Để lại câu trả lời

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

Bạn có thể sử dụng các thẻ này:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>