If for some reason you want to change the header of your WooCommerce Checkout form, here is a handy trick for checkout form heading I have experienced.
Default checkout form have following titles,
1- Billing Details
2- Shipping Details
3- Billing & Shipping Details
All above titles can be changed to what you need in a few steps.
Scenario 1: Stores with shipped products.
If you’re selling shipped products and your customers don’t have to enter a separate billing address, you can use the built-in WooCommerce address feature.
1) In WordPress admin, go to WooCommerce > Settings
2) Click Checkout form heading tab ‘Shipping’
3- Click the Shipping Options
4) Select ‘Force shipping to customer billing address’ for ‘Shipping destination’ and save.
5) Change the “Billing and Shipping address” heading into ‘Shipping Info’
By default, the heading for the address fields will be ‘Billing and Shipping address’.
You can override this with the following snippet. You will need to paste this code in your themes ‘functions.php’ file. Best practice is to use in child theme’s functions.php file.
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case ‘Billing & Shipping’ :
$translated_text = __( ‘Shipping Info’, ‘woocommerce’ );
break;
}
return $translated_text;
}
add_filter( ‘gettext’, ‘wc_billing_field_strings’, 20, 3 );
Scenario 2.
If you want to change only Billing Details heading into any other custom heading, then follow the same code with small tweaks, just replace “case ‘Billing Details’
Here is the snippet;
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case ‘Billing Details’ :
$translated_text = __( ‘Your Info’, ‘woocommerce’ );
break;
}
return $translated_text;
}
add_filter( ‘gettext’, ‘wc_billing_field_strings’, 20, 3 );
Same code is applied to the Shipping Details heading. Just try it and you will get the results. If you need any assistance, don’t forget to contact me through comments section.
Leave a Reply