Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuadavidnelson/4827eed53b25362953fae9e7e95c3899 to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/4827eed53b25362953fae9e7e95c3899 to your computer and use it in GitHub Desktop.
Alter the output of a specific WooCommerce My Account column, in this case replacing the date format used for displaying the order date.
<?php
/**
* Alter the date order output (in this case, the format of the displayed date).
*
* @param object $order
*/
add_action( 'woocommerce_my_account_my_orders_column_order-date', 'alter_order_date_format', 10, 1 );
function alter_order_date_format( $order ) {
echo '<time datetime="' . date( 'Y-m-d', strtotime( $order->order_date ) ) . '" title="' . esc_attr( strtotime( $order->order_date ) ) . '">' . date_i18n( 'm/d/Y', strtotime( $order->order_date ) ) . '</time>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment