I've already renamed my order status 'completed' to 'paid' using this code
function wc_renaming_order_status( $order_statuses ) {
foreach ( $order_statuses as $key => $status ) {
$new_order_statuses[ $key ] = $status;
if ( 'wc-completed' === $key ) {
$order_statuses['wc-completed'] = _x( 'Paid', 'Order status', 'woocommerce' );
}
}
return $order_statuses;
}
add_filter( 'wc_order_statuses', 'wc_renaming_order_status' );
And now I need to rename bulk options in my order list admin. I've used this code:
add_action('admin_footer-edit.php', 'custom_bulk_admin_footer');
function custom_bulk_admin_footer() {
global $post_type;
if($post_type == 'shop_order') {
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('<option>').val('shipped').text('<?php _e('Mark as shipped')?>').appendTo("select[name='action']");
jQuery('<option>').val('shipped').text('<?php _e('Mark as shipped')?>').appendTo("select[name='action2']");
});
</script>
<?php
}
}
But only worked for add a new option, what I really need is to rename bulk option 'Mark as completed' to 'Mark as paid'
How can I solve this?
Thanks
It's possible using wordpress gettex()
native function. You will get this:
This is the code:
add_filter('gettext', 'wc_renaming_bulk_status', 20, 3);
function wc_renaming_bulk_status( $translated_text, $untranslated_text, $domain ) {
if( is_admin()) {
if( $untranslated_text == 'Mark complete' )
$translated_text = __( 'Mark paid','theme_text_domain' );
}
return $translated_text;
}
This code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested and works.