- 상태
- 미해결
- 보고된 제품
- WPML Multilingual & Multicurrency for WooCommerce 5.5.3.1
- 관련 플러그인/테마
- WooCommerce Product Bundles
- 주제 태그
- WCML
문제 개요
WooCommerce Multilingual과 WooCommerce Product Bundles를 사용하여 묶음 상품을 번역할 때 번역된 상품에 묶음 항목이 모두 누락될 수 있습니다. 이 문제는 데이터베이스 불일치로 인해 번역 시 묶음 상품 데이터가 제대로 동기화되지 않을 때 발생합니다.
임시 해결 방법
진행하기 전에 사이트의 전체 사이트 백업을 완료했는지 확인하세요.
- …/woocommerce-multilingual/compatibility/WcProductBundles/class-wcml-product-bundles.php 파일을 여세요.
- 다음 코드 바로 뒤에:
if ( ! $translated_item_id ) { $menu_order = $this->wpdb->get_var( $this->wpdb->prepare( " SELECT menu_order FROM {$this->wpdb->prefix}woocommerce_bundled_items WHERE bundle_id=%d AND product_id=%d ", $bundle_id, $product_id ) ); $this->wpdb->insert( $this->wpdb->prefix . 'woocommerce_bundled_items', [ 'product_id' => $translated_product_id, 'bundle_id' => $translated_bundle_id, 'menu_order' => $menu_order, ] ); $translated_item_id = $this->wpdb->insert_id; $this->set_translated_item_id_relationship( $item_id, $translated_item_id, $lang ); } - 다음을 추가하세요:
$check = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT bundled_item_id FROM {$this->wpdb->prefix}woocommerce_bundled_items WHERE bundled_item_id = %d AND bundle_id = %d", $translated_bundle_id, $translated_product_id ) ); if ( !$check ) { $menu_order = $this->wpdb->get_var( $this->wpdb->prepare( " SELECT menu_order FROM {$this->wpdb->prefix}woocommerce_bundled_items WHERE bundle_id=%d AND product_id=%d ", $bundle_id, $product_id ) ); $this->wpdb->insert( $this->wpdb->prefix . 'woocommerce_bundled_items', [ 'bundled_item_id' => $translated_item_id, 'product_id' => $translated_product_id, 'bundle_id' => $translated_bundle_id, 'menu_order' => $menu_order, ] ); } - 마지막으로 원래 상품을 다시 저장하세요.