Snippets

Visser Labs Adding a custom Last Modified Order field to the Orders export type

Created by Michael Visser

File functions.php Added

  • Ignore whitespace
  • Hide word diff
+<?php
+function custom_woo_ce_extend_order_fields( $fields ) {
+
+	$fields[] = array(
+		'name' => 'order_modified',
+		'label' => 'Last Modified',
+		'hover' => 'Last Modified field within functions.php'
+	);
+	return $fields;
+
+}
+add_filter( 'woo_ce_order_fields', 'custom_woo_ce_extend_order_fields' );
+
+function custom_woo_ce_extend_order( $order, $order_id ) {
+
+    $date_format = woo_ce_get_option( 'date_format', 'd/m/Y' );
+	$order->order_modified = get_post_modified_time( $date_format, false, $order_id, false );
+	return $order;
+
+}
+add_filter( 'woo_ce_order', 'custom_woo_ce_extend_order', 10, 2 );
+?>