WPML
Stato
Risolto dall’autore
Risolto in
WoodMart 8.0.2
Plugin/tema correlato
Woodmart
Tag dell’argomento
Compatibility

Panoramica del problema

Se stai usando il tema Woodmart insieme a WPML, potresti riscontrare un problema in cui la traduzione di un Product Layout si blocca e non viene completata. Inoltre, troverai un errore simile:


Call to a member function get_gallery_image_ids() on null .../wp-content/themes/woodmart/woocommerce/single-product/product-image.php:27

Soluzione alternativa

Assicurati di avere un backup completo del sito prima di procedere.


  • Apri il file functions.php del tuo tema.

  • Aggiungi il seguente 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 );
        }
    } );

  • Svuota la cache e traduci nuovamente il layout del prodotto.
Aggiornamento: il team di WoodMart ha reso disponibile anche una patch che dovrebbe risolvere il problema nel prossimo aggiornamento.

  • Vai su Bacheca di WordPress -> WoodMart -> Patcher.

  • Seleziona la patch numero 618307.

Tutti i problemi noti →