Skip to content

Instantly share code, notes, and snippets.

@mralaminahamed
Last active October 23, 2024 10:52
Show Gist options
  • Select an option

  • Save mralaminahamed/1a29bb60f80c05a1b668a750f5f21633 to your computer and use it in GitHub Desktop.

Select an option

Save mralaminahamed/1a29bb60f80c05a1b668a750f5f21633 to your computer and use it in GitHub Desktop.
Add custom order statuses to the whitelist.
<?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