Remove helpers from order functions
This commit is contained in:
parent
facfb16131
commit
7228d67799
|
@ -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' );
|
||||
|
|
Loading…
Reference in New Issue