WPML
Status
Open
Reported for
WPML Multilingual & Multicurrency for WooCommerce 5.3.2
Topic tags
Bug

Overview of the issue

Currently, the order note added automatically after a first purchase may appear in the language where the order was done, instead of the default admin language. This issue is specific to situations where the user completes the purchase in a secondary language.

Workaround

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


  • Open your theme’s functions.php file.

  • Add the following snippet:
    // 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 );

All known issues →