Introduced new hooks for jetpack sync

This commit is contained in:
Claudio Sanches 2019-02-01 15:43:24 -02:00
parent 3fa704f7f4
commit 07f3f33566
5 changed files with 22 additions and 4 deletions

View File

@ -327,11 +327,13 @@ class WC_Admin_Reports_Coupons_Data_Store extends WC_Admin_Reports_Data_Store im
$coupon_items = $order->get_items( 'coupon' );
foreach ( $coupon_items as $coupon_item ) {
$coupon_id = wc_get_coupon_id_by_code( $coupon_item->get_code() );
$wpdb->replace(
$wpdb->prefix . self::TABLE_NAME,
array(
'order_id' => $order_id,
'coupon_id' => wc_get_coupon_id_by_code( $coupon_item->get_code() ),
'coupon_id' => $coupon_id,
'discount_amount' => $coupon_item->get_discount(),
'date_created' => date( 'Y-m-d H:i:s', $order->get_date_created( 'edit' )->getTimestamp() ),
),
@ -342,6 +344,8 @@ class WC_Admin_Reports_Coupons_Data_Store extends WC_Admin_Reports_Data_Store im
'%s',
)
);
do_action( 'woocommerce_update_reports_coupon', $coupon_id, $order_id );
}
}

View File

@ -434,8 +434,11 @@ class WC_Admin_Reports_Customers_Data_Store extends WC_Admin_Reports_Data_Store
'%s',
)
);
$customer_id = $wpdb->insert_id;
return $result ? $wpdb->insert_id : false;
do_action( 'woocommerce_new_reports_customer', $customer_id );
return $result ? $customer_id : false;
}
/**
@ -557,7 +560,10 @@ class WC_Admin_Reports_Customers_Data_Store extends WC_Admin_Reports_Data_Store
$format[] = '%d';
}
return $wpdb->replace( $wpdb->prefix . self::TABLE_NAME, $data, $format );
$results = $wpdb->replace( $wpdb->prefix . self::TABLE_NAME, $data, $format );
do_action( 'woocommerce_update_reports_customer', $customer_id );
return $results;
}
/**

View File

@ -445,7 +445,10 @@ class WC_Admin_Reports_Orders_Stats_Data_Store extends WC_Admin_Reports_Data_Sto
}
// Update or add the information to the DB.
return $wpdb->replace( $table_name, $data, $format );
$results = $wpdb->replace( $table_name, $data, $format );
do_action( 'woocommerce_update_reports_order_stats', $order->get_id() );
return $results;
}
/**

View File

@ -343,6 +343,7 @@ class WC_Admin_Reports_Products_Data_Store extends WC_Admin_Reports_Data_Store i
array( 'order_item_id' => $order_item_id ),
array( '%d' )
);
do_action( 'woocommerce_delete_reports_product', $order_item_id, $order->get_id() );
} else {
$wpdb->replace(
$wpdb->prefix . self::TABLE_NAME,
@ -367,6 +368,8 @@ class WC_Admin_Reports_Products_Data_Store extends WC_Admin_Reports_Data_Store i
'%s',
)
);
do_action( 'woocommerce_update_reports_product', $order_item_id, $order->get_id() );
}
}
}

View File

@ -284,6 +284,8 @@ class WC_Admin_Reports_Taxes_Data_Store extends WC_Admin_Reports_Data_Store impl
'%f',
)
);
do_action( 'woocommerce_update_reports_tax', $tax_item->get_rate_id(), $order->get_id() );
}
}