Untitled

From Ungracious Water Vole, 1 Month ago, written in Plain Text, viewed 133 times.
URL http://codebin.org/view/f9329c3c Embed
Download Paste or View Raw
  1. // Add custom Woocommerce order status?
  2. function register_in_progress_order_status() {
  3.     register_post_status( 'wc-invoiced', array(
  4.             'label' => _x( 'In-progress', 'Order Status', 'woocommerce' ),
  5.             'public' => true,
  6.             'exclude_from_search' => false,
  7.             'show_in_all_admin_list' => true,
  8.             'show_in_admin_status_list' => true,
  9.             'label_count' => _n_noop( 'In-progress <span class="count">(%s)</span>', 'In-progress <span class="count">(%s)</span>', 'woocommerce' )
  10.         )
  11.     );
  12. }
  13.  
  14. add_action( 'init', 'register_in_progress_order_status' );
  15.  
  16. function my_invoiced_order_status( $order_statuses ){
  17.     $order_statuses['wc-invoiced'] = _x( 'In-progress', 'Order Status', 'woocommerce' );
  18.     return $order_statuses;
  19.  
  20. }
  21. add_filter( 'wc_order_statuses', 'my_invoiced_order_status' );
  22.  
  23. function show_in_bulk_actions() {
  24.     global $post_type;
  25.  
  26.     if( 'shop_order' == $post_type ) {
  27.         ?>
  28.             <script type="text/javascript">
  29.                 jQuery(document).ready(function(){
  30.                     jQuery('<option>').val('mark_invoiced').text('<?php _e( 'Change Status to In-progress','woocommerce' ); ?>').appendTo("select[name='action']");
  31.                     jQuery('<option>').val('mark_invoiced').text('<?php _e( 'Change Status to In-progress','woocommerce' ); ?>').appendTo("select[name='action2']");
  32.                 });
  33.             </script>
  34.         <?php
  35.     }
  36. }
  37.  
  38. add_action( 'admin_footer', 'show_in_bulk_actions' );

Reply to "Untitled"

Here you can reply to the paste above