Last active
October 23, 2024 10:52
-
-
Save mralaminahamed/1a29bb60f80c05a1b668a750f5f21633 to your computer and use it in GitHub Desktop.
Add custom order statuses to the whitelist.
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
| <?php | |
| /** | |
| * Add custom order statuses to the whitelist. | |
| * | |
| * @param array $whitelist The default whitelist of allowed status transitions. | |
| * | |
| * @return array Modified whitelist including custom statuses. | |
| */ | |
| function dokan_support_add_custom_order_statuses( $whitelist ) { | |
| $custom_statuses = [ | |
| 'wc-pre-envio' => [ 'wc-processing' ], | |
| 'wc-refund-req' => [ 'wc-processing' ], | |
| 'wc-delivered' => [ 'wc-completed' ], | |
| ]; | |
| foreach ( $custom_statuses as $status => $allowed_transitions ) { | |
| $whitelist[ $status ] = $allowed_transitions; | |
| } | |
| return $whitelist; | |
| } | |
| // add custom order statuses | |
| add_filter( 'dokan_sub_order_status_update_whitelist', 'dokan_support_add_custom_order_statuses', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment