Make sure post_author is used only after WC 3.3.0 DB upgrade routine is executed

This commit is contained in:
Rodrigo Primo 2017-12-08 15:55:53 -02:00
parent ad4304450d
commit 997a6fa40d
1 changed files with 8 additions and 1 deletions

View File

@ -107,10 +107,17 @@ class WC_Order_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT implement
$date_paid = get_post_meta( $id, '_paid_date', true );
}
// Make sure post_author is used only after WC 3.3.0 DB upgrade routine is executed.
if ( version_compare( get_option( 'woocommerce_db_version' ), '3.3.0', '>=' ) ) {
$customer_id = $post_object->post_author;
} else {
$customer_id = get_post_meta( $id, '_customer_user', true );
}
$order->set_props(
array(
'order_key' => get_post_meta( $id, '_order_key', true ),
'customer_id' => $post_object->post_author,
'customer_id' => $customer_id,
'billing_first_name' => get_post_meta( $id, '_billing_first_name', true ),
'billing_last_name' => get_post_meta( $id, '_billing_last_name', true ),
'billing_company' => get_post_meta( $id, '_billing_company', true ),