Punt to WC version 3.5.0
This commit is contained in:
parent
4123cc6f7d
commit
ccf10f6ab2
|
@ -751,7 +751,8 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
|
|||
if ( ! empty( $_GET['_customer_user'] ) ) { // WPCS: input var ok.
|
||||
$customer_id = (int) $_GET['_customer_user']; // WPCS: input var ok, sanitization ok.
|
||||
|
||||
if ( version_compare( get_option( 'woocommerce_db_version' ), '3.4.0', '>=' ) ) {
|
||||
// On WC 3.5.0 the ID of the user that placed the order was moved from the post meta _customer_user to the post_author field in the wp_posts table.
|
||||
if ( version_compare( get_option( 'woocommerce_db_version' ), '3.5.0', '>=' ) ) {
|
||||
$query_vars['author'] = $customer_id;
|
||||
} else {
|
||||
// @codingStandardsIgnoreStart
|
||||
|
|
|
@ -100,10 +100,12 @@ class WC_Install {
|
|||
'wc_update_330_db_version',
|
||||
),
|
||||
'3.4.0' => array(
|
||||
'wc_update_340_order_customer_id',
|
||||
'wc_update_340_irish_states',
|
||||
'wc_update_340_db_version',
|
||||
),
|
||||
'3.5.0' => array(
|
||||
'wc_update_350_order_customer_id',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -107,8 +107,8 @@ 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.4.0 DB upgrade routine is executed.
|
||||
if ( version_compare( get_option( 'woocommerce_db_version' ), '3.4.0', '>=' ) ) {
|
||||
// On WC 3.5.0 the ID of the user that placed the order was moved from the post meta _customer_user to the post_author field in the wp_posts table.
|
||||
if ( version_compare( get_option( 'woocommerce_db_version' ), '3.5.0', '>=' ) ) {
|
||||
$customer_id = $post_object->post_author;
|
||||
} else {
|
||||
$customer_id = get_post_meta( $id, '_customer_user', true );
|
||||
|
|
|
@ -1678,15 +1678,22 @@ function wc_update_340_irish_states() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update DB Version.
|
||||
*/
|
||||
function wc_update_340_db_version() {
|
||||
WC_Install::update_db_version( '3.4.0' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy order customer_id from post meta to post_author and set post_author to 0 for refunds.
|
||||
*
|
||||
* @param WC_Background_Updater $updater Background updater instance.
|
||||
*/
|
||||
function wc_update_340_order_customer_id( $updater ) {
|
||||
function wc_update_350_order_customer_id( $updater ) {
|
||||
global $wpdb;
|
||||
|
||||
$post_types = (array) apply_filters( 'woocommerce_update_340_order_customer_id_post_types', array( 'shop_order' ) );
|
||||
$post_types = (array) apply_filters( 'woocommerce_update_350_order_customer_id_post_types', array( 'shop_order' ) );
|
||||
$post_types_placeholders = implode( ', ', array_fill( 0, count( $post_types ), '%s' ) );
|
||||
$admin_orders_sql = '';
|
||||
|
||||
|
@ -1761,10 +1768,3 @@ function wc_update_340_order_customer_id( $updater ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update DB Version.
|
||||
*/
|
||||
function wc_update_340_db_version() {
|
||||
WC_Install::update_db_version( '3.4.0' );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue