Skip to content

Instantly share code, notes, and snippets.

@jrick1229
Last active November 29, 2018 17:17
Show Gist options
  • Save jrick1229/985d4a91f3f41df7855ab0d960429583 to your computer and use it in GitHub Desktop.
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
<?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