Created
April 12, 2022 17:19
-
-
Save helgatheviking/af66afb13f576de4fd966e8c5beb7e76 to your computer and use it in GitHub Desktop.
Change Billing Details text on free checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function kia_translate_billing_details_when_free( $translated_text, $untranslated_text, $domain ) { | |
if ( function_exists( 'wc' ) && 'woocommerce' === $domain ) { | |
//make the changes to the text | |
switch( $untranslated_text ) { | |
case 'Billing details': | |
if ( ! WC()->cart->needs_shipping() && 0.0 === floatval( WC()->cart->get_total( 'edit' ) ) ) { | |
$translated_text = __( 'NOT billing details', 'kia_textdomain' ); | |
} | |
break; | |
} | |
} | |
return $translated_text; | |
} | |
add_filter( 'gettext', 'kia_translate_billing_details_when_free', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment