Change Label for field used in Woo Commerce

I’m using WooCommerce, and using a BACS Payment method which is actually Bank Trasnfer. The fields account details are fine, but for Indian context.. i need to change following two fields labels to something else. For example:

Change IBAN label to MICR Code, and
BIC to IFSC.

Read More

And also need to disable Sort Code.

However, please note that I don’t to make chanegs into plugin’s code itself. So looking for some function that can help change the label from my theme function file.

Any help is appreciated.

Related posts

Leave a Reply

1 comment

  1. It gets its label using a localisation call, __('IBAN', 'woocommerce'), so you could always just intercept that and change the text:

    /**
    * filter translations, to replace some WooCommerce text with our own
    * @param string $translation the translated text
    * @param string $text the text before translation
    * @param string $domain the gettext domain for translation
    * @return string
    */
    function wpse_77783_woo_bacs_ibn($translation, $text, $domain) {
        if ($domain == 'woocommerce') {
            switch ($text) {
                case 'IBAN':
                    $translation = 'MICR';
                    break;
    
                case 'BIC':
                    $translation = 'IFSC';
                    break;
            }
        }
    
        return $translation;
    }
    
    add_filter('gettext', 'wpse_77783_woo_bacs_ibn', 10, 3);