Add Custom Fields to Order Details Page – WooCommerce WordPress Problem Solution

Add Custom Fields to Order Details Page

sometimes few filed needed when delivery complete or status change of a order. Like shipment date or others info which need a customer to know. Like:

Order Page custom field


Show in Order page

So need a custom hook in theme function.php file. Add this code last portion to the file. That’s it.

Code Part:

 * Add Fields Inside “Order Details” Table
 * @author Hriday Ahmed
 * @link
add_action( ‘woocommerce_order_details_after_order_table_items’, ‘hriday_order_details’ );
function hriday_order_details( $order ) {
//$download = get_post_meta( $order->get_id(), ‘download’, false );
//$shippingdate = get_post_meta( $order->get_id(), ‘shippingdate’, true );
$download = $order->get_meta( ‘download’ );
$shippingdate = $order->get_meta( ‘shippingdate’ );
if( $download ) :
<th scope=”row”>Download:</th>
<td><?php echo esc_html( $download ) ?></td>
if( $shippingdate ) :
<th scope=”row”>Shipping date:</th>
<?php //echo date( ‘F jS, Y’, strtotime( $shippingdate ) ) ?>
<?php //echo esc_html( $order->meta_data->key[‘download’] ) ?>
<?php echo $shippingdate; ?>
//code end
For more show in youtube:

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Khejur Gur