woocommerce_query_for_reserved_stock
Filter: woocommerce_query_for_reserved_stock Allows to filter the query for getting reserved stock of a product.
Usage
add_filter( 'woocommerce_query_for_reserved_stock', 'wp_kama_woocommerce_query_for_reserved_stock_filter', 10, 3 ); /** * Function for `woocommerce_query_for_reserved_stock` filter-hook. * * @param string $query The query for getting reserved stock of a product. * @param int $product_id Product ID. * @param int $exclude_order_id Order to exclude from the results. * * @return string */ function wp_kama_woocommerce_query_for_reserved_stock_filter( $query, $product_id, $exclude_order_id ){ // filter... return $query; }
- $query(string)
- The query for getting reserved stock of a product.
- $product_id(int)
- Product ID.
- $exclude_order_id(int)
- Order to exclude from the results.
Changelog
Since 4.5.0 | Introduced. |
Where the hook is called
woocommerce_query_for_reserved_stock
woocommerce/src/Checkout/Helpers/ReserveStock.php 279
return apply_filters( 'woocommerce_query_for_reserved_stock', $query, $product_id, $exclude_order_id );