Categories
WooCommerce

WooCommerce Custom Order Fields

And the Persian Mathematician.

Add to the orders custom fields which are visible only to admins:

add_action( 'woocommerce_checkout_create_order', 'condless_before_checkout_create_order', 20, 2 );
function condless_before_checkout_create_order( $order, $data ) {
	$order->update_meta_data( 'shipping_date', __( 'Empty Term.' ) );
	$order->update_meta_data( 'shipping_time', __( 'Empty Term.' ) );
}

add_action( 'woocommerce_admin_order_data_after_shipping_address', 'condless_checkout_field_display_admin_order_meta' );
function condless_checkout_field_display_admin_order_meta( $order ) {
	echo '<p><strong>'. __( 'Shipping', 'woocommerce' ) . ' ' . __( 'Date' ) . ':</strong> ' . get_post_meta( $order->get_id(), 'shipping_date', true ) . '</p>';
	echo '<p><strong>'. __( 'Shipping', 'woocommerce' ) . ' ' . __( 'Time' ) . ':</strong> ' . get_post_meta( $order->get_id(), 'shipping_time', true ) . '</p>';
}

As you probably have noticed- the source of the numbering system is India, the West was exposed to the method only in the 11th century, and mainly through the writings of the Persian Mathematician al-Khwarizmi, which the term “algorithm” was named after him.

Leave a Reply

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