Created
July 21, 2023 15:48
-
-
Save Deviant96/cc11d6e78c74bb12ca5f5ae471968646 to your computer and use it in GitHub Desktop.
Increase stock on failed and cancelled order for Woocommerce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('woocommerce_order_status_changed', 'custom_increase_stock_on_failed_and_cancelled_order', 10, 4 ); | |
function custom_increase_stock_on_failed_and_cancelled_order( $order_id, $old_status, $new_status, $order ){ | |
if ( $new_status == 'cancelled' || $new_status == 'failed' ){ | |
wc_maybe_increase_stock_levels( $order_id ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment