Last active
November 29, 2018 17:17
-
-
Save jrick1229/985d4a91f3f41df7855ab0d960429583 to your computer and use it in GitHub Desktop.
Change 'Billing Details' title in checkout to be 'Account Info' when cart total is equal to ZERO
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
<?php | |
function wcs_free_checkout_fields() { | |
// Bail we're not at checkout, or if we're at checkout but payment is needed | |
if ( function_exists( 'is_checkout' ) && ( ! is_checkout() || ( is_checkout() && WC()->cart->needs_payment() ) ) ) { | |
return; | |
} | |
// Change string here | |
function wc_billing_field_strings( $translated_text, $text, $domain ) { | |
switch ( $translated_text ) { | |
case 'Billing details' : | |
$translated_text = __( 'Account Info', 'woocommerce' ); | |
break; | |
} | |
return $translated_text; | |
} | |
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 ); | |
} | |
add_action( 'wp', 'wcs_free_checkout_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment