plugins - Change Label for field used in Woo Commerce

admin2025-05-31  0

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.

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.

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.

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.

Share Improve this question asked Dec 31, 2012 at 11:29 KrunalKrunal 2213 gold badges8 silver badges17 bronze badges 2
  • Are you sure the documentation has nothing about this? The answer to your other similar Question was a "Google this for me" solution... – brasofilo Commented Dec 31, 2012 at 13:06
  • Yes, after posting it here.. I find a way to implement it in Woo Commerce codex. But earlier I was unable to find that, hence posted it here. Thanks – Krunal Commented Jan 1, 2013 at 5:27
Add a comment  | 

1 Answer 1

Reset to default 5

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);
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748626169a313620.html

最新回复(0)