Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
Created April 12, 2022 17:19
Show Gist options
  • Save helgatheviking/af66afb13f576de4fd966e8c5beb7e76 to your computer and use it in GitHub Desktop.
Save helgatheviking/af66afb13f576de4fd966e8c5beb7e76 to your computer and use it in GitHub Desktop.
Change Billing Details text on free checkout
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