- ステータス
- 未解決
- 報告対象
- WPML Multilingual & Multicurrency for WooCommerce 5.3.2
- トピックタグ
- Bug
問題の概要
現在、初回購入後に自動的に追加される注文メモが、デフォルトの管理画面言語ではなく、注文が行われた言語で表示される場合があります。この問題は、ユーザーがセカンダリ言語で購入を完了した場合に発生します。
回避策
続行する前に、必ずサイトの完全なバックアップを取得してください。
- テーマのfunctions.phpファイルを開きます。
- 以下のスニペットを追加します。
// The action is added only once, we are removing it just after it's called. // The same happens for the hook to restore the language once the note is added. $temporarilySwitchToDefaultLang = function() use ( &$temporarilySwitchToDefaultLang ) { add_action( 'woocommerce_order_status_processing', $temporarilySwitchToDefaultLang ); do_action( 'wpml_switch_language', apply_filters( 'wpml_default_language', null ) ); $restoreLang = function() use ( &$restoreLang ) { remove_action( 'woocommerce_order_note_added', $restoreLang ); do_action( 'wpml_switch_language', null ); }; add_action( 'woocommerce_order_note_added', $restoreLang ); }; add_action( 'woocommerce_order_status_processing', $temporarilySwitchToDefaultLang );