Created
October 14, 2024 13:10
-
-
Save webtoffee-git/1f8f23d45049723968e84af765d790d2 to your computer and use it in GitHub Desktop.
To prevent old order numbers getting updated while changing order status - By WebToffee (Sequential Order Number for WooCommerce Free)
This file contains 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
<?php //Do not copy this line of code | |
add_action('init', 'remove_order_status_changed_order_number', 15); | |
function remove_order_status_changed_order_number() { | |
if (class_exists('Wt_Advanced_Order_Number')) { | |
foreach ($GLOBALS['wp_filter']['woocommerce_order_status_changed']->callbacks as $priority => $hooks) { | |
foreach ($hooks as $hook_id => $hook) { | |
if (is_array($hook['function']) && is_object($hook['function'][0])) { | |
$object = $hook['function'][0]; | |
if (get_class($object) === 'Wt_Advanced_Order_Number') { | |
remove_action('woocommerce_order_status_changed', array($object, 'wt_seq_order_status_changed'), 10, 4); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment