Need to replace text in woocommerce confirmation page

I want to replace the text marked in yellow here:

https://cdn.livechat-static.com/api/file/lc/att/8801096/860a24433a28c02afe706d303ff8d284/Capture.PNG

with this :
1. Bekräftelse
2. Tack! Vi har mottagit din offertförfrågan.
3. Nummer

  • Nahid
    • Ex Staff

    Hi there, Thomas !
    I hope you are having a great day!

    This request has been escalated to our Second Level Support team so that they can take a closer look at it. Please note that the response time of the Second Level Support team might be a bit delayed than that of the general Support staff. I or another colleague of mine will let you know here as soon as we have an update. We really appreciate your patience regarding this.

    However, please note that, since this is a custom code query involving third-party plugins, we cannot guarantee a resolution from our end. We’ll try our best but if in case it turns out to be out of our scope of support, it might be considered as custom development. We really appreciate your consideration regarding this.

    Kind regards,
    Nahid

  • Alessandro
    • Nightcrawler & Daydreamer

    Hello Thomas.

    I checked your website and update the gettext filter hook for you to apply only on “Order Received” page.

    I noticed many calls to gettext hook. Keep in mind that using this hook directly may cause text change in many places you do not expect. So, use wisely and add conditions to eliminate any chance of unexpected behavior.

    Using gettext hook to alter text is not the intended way to do. Many calls may impact your website’s performance.
    If you want to add a new language to your content, consider using translations (for WooCommerce). If you want to change/add/remove content, consider using template files and override parts you like.

    add_filter( 'gettext', 'wpmudev_translate_woocommerce_strings', 999, 3 );
    function wpmudev_translate_woocommerce_strings( $translated, $untranslated, $domain ) {
        if ( ! is_admin() && 'woocommerce' === $domain && is_wc_endpoint_url( 'order-received' ) ) {
            switch ( $translated ) {
                case 'Bekräftelse' :
                    $translated = 'Kontaktuppgifter';
                break;
                case 'Tack! Vi har mottagit din offertförfrågan' :
                    $translated = 'Beställning';
    			break;
                case 'Nummer' :
                    $translated = 'Ordernummer';
                break;
            }
        }
        return $translated;
    }

    Append this code to your theme’s functions.php and it will work.

    Note: We always recommend to append any snippets in your child’s theme functions.php to allow parent themes to be updated without losing your modifications.

    Let us know if this worked for you.

    Kind regards,
    Alessandro.

  • Thomas
    • The Incredible Code Injector

    Hello. Thank you for the code. I’ve made some changes to the site and two cases stopped working. Not sure if it has to do with the Loco translation plugin or not.

    The two cases not working are:

    case ‘Bekräftelse’ :
    case ‘Nummer’ :

    I got the case ‘Nummer’ : to work by translating the string in Loco Translate. But the case ‘Bekräftelse’ : is till not working. That is, Kontaktuppgifter in the title should be replaced by Bekräftelse. Could it be that Kontaktuppgifter (previously Billing address) is also found at the bottom of the page?

    Can you please check again what might cause this?