Hi. How can we help?

How to show labels for all WooCommerce default fields in Order Detail Page (My Account) using Checkout Manager

By default WooCommerce show all cutomer informations without use any label for each field in Thanyou Page.
 
01.png
 
To improve this fucntion you can use following code, to add in the file functions.php of your theme.
 
if( !function_exists('yith_customize_woocommerce_order_formatted_billing_address') ){
function yith_customize_woocommerce_order_formatted_billing_address( $address ){
if( function_exists('ywccp_get_custom_fields') ){
$custom_billing_fields = ywccp_get_custom_fields( 'billing' );
foreach ( $address as $key => $value ){
if( array_key_exists( 'billing_' . $key, $custom_billing_fields ) ) continue;
$address[$key] = ucwords(str_replace( '_',' ',$key )) . ': ' . $value;
}
}

return $address;
}
}
add_filter('woocommerce_order_formatted_billing_address','yith_customize_woocommerce_order_formatted_billing_address',10 );


if( !function_exists('yith_customize_woocommerce_order_formatted_shipping_address') ){
function yith_customize_woocommerce_order_formatted_shipping_address( $address ){
if( function_exists('ywccp_get_custom_fields') ){
$custom_shipping_fields = ywccp_get_custom_fields( 'shipping' );
foreach ( $address as $key => $value ){
if( array_key_exists( 'shipping_' . $key, $custom_shipping_fields ) ) continue;
$address[$key] = ucwords(str_replace( '_',' ',$key )) . ': ' . $value;
}
}

return $address;
}

}
add_filter('woocommerce_order_formatted_shipping_address','yith_customize_woocommerce_order_formatted_shipping_address',10 );
 
In this way you'll see billing and Shipping Informations like in the screenshot
 
02.png
Was this article helpful?
0 out of 0 found this helpful

Back to Help Center >

Powered by Zendesk