WPML
状态
未解决
报告针对
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 );

所有已知问题 →