Forked from helgatheviking/billing-details-translation.php
Created
April 12, 2022 18:31
-
-
Save elpuas/d49b9830a2de427271866c9b98792251 to your computer and use it in GitHub Desktop.
Change Billing Details text on free checkout
This file contains hidden or 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