[insert_php] function get_last_order_id(){
global $wpdb;
$statuses = array_keys(wc_get_order_statuses());
$statuses = implode( “‘,'”, $statuses );

// Getting last Order ID (max value)
$results = $wpdb->get_col( ”
SELECT MAX(ID) FROM {$wpdb->prefix}posts
WHERE post_type LIKE ‘shop_order’
AND post_status IN (‘$statuses’)
” );
return reset($results);
}

$latest_order_id = get_last_order_id(); // Last order ID
$order = wc_get_order( $latest_order_id ); // Get an instance of the WC_Order oject
$order_details = $order->get_data(); // Get the order data in an array

// Raw output test
//echo ‘

'; print_r( $order_details ); echo '

‘;

echo ‘order ล่าสุดหมายเลข :

‘.$latest_order_id.’

‘;

[/insert_php]

[insert_php] /* translators: 1: order number 2: order date 3: order status */
echo wp_kses_post( apply_filters( ‘woocommerce_order_tracking_status’, sprintf(
__( ‘Order #%1$s was placed on %2$s and is currently %3$s.’, ‘woocommerce’ ),
‘‘ . $order->get_order_number() . ‘‘,
‘‘ . wc_format_datetime( $order->get_date_created() ) . ‘‘,
‘‘ . wc_get_order_status_name( $order->get_status() ) . ‘‘
) ) );
if ( $notes = $order->get_customer_order_notes() ) :
foreach ( $notes as $note ) :
echo wpautop( wptexturize( $note->comment_content )).’
‘;
endforeach;
endif;
[/insert_php] [insert_php] do_action( ‘woocommerce_view_order’, $order->get_id() ); [/insert_php]

ที่อยู่

[insert_php] echo ‘ชื่อ ‘.$order->get_billing_first_name().’
‘;
echo ‘ทีอยู่ ‘.$order->get_billing_address_1().’
‘;
echo ‘รหัสไปรษณีย์ ‘.$order->get_billing_postcode().’
‘;
echo ‘เบอร์โทร ‘.$order->get_billing_phone().’
‘;
[/insert_php]