wc_release_stock_for_order( WC_Order|int $order )

Release held stock for an order.


Description Description


Parameters Parameters

$order

(Required) Order ID or instance.


Top ↑

Source Source

File: includes/wc-stock-functions.php

365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
function wc_release_stock_for_order( $order ) {
    /**
     * Filter: woocommerce_hold_stock_for_checkout
     * Allows enable/disable hold stock functionality on checkout.
     *
     * @since 4.3.0
     * @param bool $enabled Default to true if managing stock globally.
     */
    if ( ! apply_filters( 'woocommerce_hold_stock_for_checkout', wc_string_to_bool( get_option( 'woocommerce_manage_stock', 'yes' ) ) ) ) {
        return;
    }
 
    $order = $order instanceof WC_Order ? $order : wc_get_order( $order );
 
    if ( $order ) {
        ( new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock() )->release_stock_for_order( $order );
    }
}

Top ↑

Changelog Changelog

Changelog
Version Description
4.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.