تخطي الملاحة

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>