I currently have a bit of code in my child theme's functions.php file which is supposed to change "Billing Details" to say "Shipping Details" on my Woocommerce checkout page.
However, when I updated to Woocommerce 3.0, the code snippet stopped working. Below is the code I was using.
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing Details' :
$translated_text = __( 'Shipping Details', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
I would really like a code snippet that works with Woocommerce 3.0.
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing details' :
$translated_text = __( 'Billing Info', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
Tested OK with WooCommerce 3.0.6
To override woocommerce views, you need to copy the required template files from woocommerce/templates to your theme directory. In this case copy woocommerce/templates/checkout/form_billing.php to your theme folder as woocommerce/checkout/form_billing.php and edit the following code around line 27.
<?php if ( wc_ship_to_billing_address_only() && WC()->cart->needs_shipping() ) : ?>
<h3><?php _e( 'Billing & Shipping', 'woocommerce' ); ?></h3>
<?php else : ?>
<h3><?php _e( 'Billing details', 'woocommerce' ); ?></h3>
<?php endif; ?>
来源:https://stackoverflow.com/questions/44419189/change-billing-details-text-to-shipping-details-on-woocommerce-checkout-page