|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * Add new Invoiced status for woocommerce |
| 5 | + */ |
| 6 | +add_action('init', 'register_notchpay_new_order_statuses'); |
| 7 | + |
| 8 | +function register_notchpay_new_order_statuses() |
| 9 | +{ |
| 10 | + register_post_status('wc-invoiced', array( |
| 11 | + 'label' => _x('Invoiced', 'Order status', 'wc-notchpay'), |
| 12 | + 'public' => true, |
| 13 | + 'exclude_from_search' => false, |
| 14 | + 'show_in_admin_all_list' => true, |
| 15 | + 'show_in_admin_status_list' => true, |
| 16 | + 'label_count' => _n_noop('Invoiced <span class="count">(%s)</span>', 'Invoiced<span class="count">(%s)</span>', 'wc-notchpay') |
| 17 | + )); |
| 18 | +} |
| 19 | + |
| 20 | +add_filter('wc_order_statuses', 'notchpay_wc_order_statuses'); |
| 21 | + |
| 22 | +// Register in wc_order_statuses. |
| 23 | +function notchpay_wc_order_statuses($order_statuses) |
| 24 | +{ |
| 25 | + $order_statuses['wc-invoiced'] = _x('Invoiced', 'Order status', 'wc-notchpay'); |
| 26 | + return $order_statuses; |
| 27 | +} |
| 28 | + |
| 29 | +function notchpay_add_bulk_invoice_order_status() |
| 30 | +{ |
| 31 | + global $post_type; |
| 32 | + |
| 33 | + if ($post_type == 'shop_order') { |
| 34 | +?> |
| 35 | + <script type="text/javascript"> |
| 36 | + jQuery(document).ready(function() { |
| 37 | + jQuery('<option>').val('mark_invoiced').text('<?php _e('Change status to invoiced', 'wc-notchpay'); ?>').appendTo("select[name='action']"); |
| 38 | + jQuery('<option>').val('mark_invoiced').text('<?php _e('Change status to invoiced', 'wc-notchpay'); ?>').appendTo("select[name='action2']"); |
| 39 | + }); |
| 40 | + </script> |
| 41 | +<?php |
| 42 | + } |
| 43 | +} |
| 44 | + |
| 45 | +add_action('admin_footer', 'notchpay_add_bulk_invoice_order_status'); |
0 commit comments