YITH WooCommerce Subscription add list of all renew in the order status list
<?php
///Renewal subscription
add_filter( 'views_edit-shop_order', 'yith_add_renewal_subscription' );
function yith_add_renewal_subscription( $views ) {
$post_status = wc_get_order_statuses();
$args = array(
'post_type' => 'shop_order',
'post_status' => array_keys( $post_status ),
'meta_key' => 'is_a_renew',
'meta_value' => 'yes',
'posts_per_page' => -1
);
$posts = get_posts( $args );
$count = $posts ? count( $posts ) : 0;
$link = sprintf( '<a href="edit.php?is_a_renew=yes&post_type=shop_order">%s<span class="count"> (%d)</span></a>', __( 'Renewal subscription', 'yit' ), $count );
$views['renewal_subscription'] = $link;
return $views;
}
add_filter( 'request', 'yith_renewal_subscription_request_query' );
function yith_renewal_subscription_request_query( $vars ) {
if ( isset( $vars['post_type'] ) && $vars['post_type'] == 'shop_order' ) {
if ( ! empty( $_GET['is_a_renew'] ) ) {
$vars['meta_key'] = 'is_a_renew';
$vars['meta_value'] = wc_clean( $_GET['is_a_renew'] );
}
}
return $vars;
}