How to change WooCommerce text shipping in checkout

前端 未结 4 1704
[愿得一人]
[愿得一人] 2020-12-10 08:15

I am trying to change a text in the WooCommerce checkout page from Shipping to Delivery from Your Order Section. I tried to open t

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-10 08:49

    I can see this is an older thread but it had the answer I was looking for. I extended the solution from @Rahul S so the one function could translate multiple strings if desired. It it a revision of a function I use for Event Calendar by ModernTribe. Being in the US I used "Shipping and Handling" in place of "Delivery."

    add_filter('gettext', 'zgwd1010_woo_translations', 20, 3);
    add_filter('ngettext', 'zgwd1010_woo_translations', 20, 3);
    function zgwd1010_woo_translations( $translation, $text, $domain ) {
    
        // Put your custom text here in a key => value pair
        $custom_text = array(
            'Shipping:' => 'Shipping and Handling:',
        );
    
        if( array_key_exists( $translation, $custom_text ) ) {
            $translation = $custom_text[$translation];
        }
        return $translation;
    }
    
    

提交回复
热议问题