Advertisement
palsushobhan

wcfm-add-shipped-order-status

Jan 28th, 2025
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.18 KB | None | 0 0
  1. add_action('init', function () {
  2.     register_post_status('wc-shipped', array(
  3.         'label' => __( 'Shipped', 'woocommerce' ),
  4.         'public' => true,
  5.         'exclude_from_search' => false,
  6.         'show_in_admin_all_list' => true,
  7.         'show_in_admin_status_list' => true,
  8.         'label_count' => _n_noop('Shipped <span class="count">(%s)</span>', 'Shipped <span class="count">(%s)</span>')
  9.     ));
  10. });
  11. add_filter('wc_order_statuses', function ($order_statuses) {
  12.     $new_order_statuses = array();
  13.     foreach ($order_statuses as $key => $status) {
  14.         $new_order_statuses[$key] = $status;
  15.         if ('wc-processing' === $key) {
  16.             $new_order_statuses['wc-shipped'] = __('Shipped', 'woocommerce' );
  17.         }
  18.     }
  19.     return $new_order_statuses;
  20. });
  21. add_filter('wcfm_is_allow_change_main_order_status_on_all_item_shipped', '__return_true');
  22. add_filter('wcfm_main_order_status_on_all_item_shipped', function($status) {
  23.     return 'shipped';
  24. });
  25. add_action( 'before_wcfm_order_status_update', function() {
  26.     global $WCFMmp;
  27.     remove_action( 'before_wcfm_order_status_update', array( $WCFMmp->ajax, 'wcfmmp_vendor_order_status_update' ), 10 );
  28. }, 9);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement