콘텐츠로 건너뛰기 사이드바로 건너뛰기

Open

Reported for: WPML Multilingual & Multicurrency for WooCommerce 5.5.3.1

Topic Tags: WCML

Overview of the issue

When translating a bundled product using WooCommerce Multilingual and WooCommerce Product Bundles, you may find that the translated product is missing all bundled items. This issue happens when there’s a database inconsistency which prevents a proper synchronization of bundled product data in the translation.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open …/woocommerce-multilingual/compatibility/WcProductBundles/class-wcml-product-bundles.php file.
  • Just after this code:
    					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 );
    					}
    
  • Add this:
    					$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,
    							]
    						);
    					}
    
  • Finally, resave the original product.

응답 2개 대상 “WooCommerce Product Bundles - Bundled Products Not Synced in Translations”

  1. Just tested this, because none of my bundles worked anymore after the latest updates. All showed “0” as price, because the translated single items were not attributed to the translated bundles.

    Did not work. Replaced the code in the php file as indicated, deleted translations (English and French from German) and translated one from anew to test -> still did not find / connect the translated items. Price 0, empty bundle.

    This needs to be fixed quickly. Worked before.

    • Hello Oliver,
      It seems like a different case than the one reported here and it needs some investigation.
      Could you please open a chat in our support forum? In that way, one of specialists will be able to investigate your case.
      Regards

답글 남기기

주제에 집중하고 다른 사람을 존중해 주세요. 이 게시물과 관련 없는 문제에 도움이 필요하면 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하세요.

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