Remove helpers from order functions

This commit is contained in:
Mike Jolley 2020-02-19 11:54:06 +00:00
parent facfb16131
commit 7228d67799
1 changed files with 0 additions and 19 deletions

View File

@ -807,8 +807,6 @@ function wc_order_search( $term ) {
function wc_update_total_sales_counts( $order_id ) {
$order = wc_get_order( $order_id );
$order->release_held_stock();
if ( ! $order || $order->get_data_store()->get_recorded_sales( $order ) ) {
return;
}
@ -887,23 +885,6 @@ function wc_update_coupon_usage_counts( $order_id ) {
$order->get_data_store()->release_held_coupons( $order, true );
}
}
/**
* Release held stock if any for an order.
*
* @since 3.9.0
* @param int $order_id Order ID.
*/
function wc_release_held_stock( $order_id ) {
$order = wc_get_order( $order_id );
if ( ! $order ) {
return;
}
$order->release_held_stock();
}
add_action( 'woocommerce_order_status_cancelled', 'wc_release_held_stock' );
add_action( 'woocommerce_order_status_pending', 'wc_update_coupon_usage_counts' );
add_action( 'woocommerce_order_status_completed', 'wc_update_coupon_usage_counts' );
add_action( 'woocommerce_order_status_processing', 'wc_update_coupon_usage_counts' );