[groups_woocommerce_subscriptions_table columns=”title,start_date,status,groups” status=”*”]

function active_subscription_list($from_date=null, $to_date=null) { // Get all customer orders $subscriptions = get_posts( array( ‘numberposts’ => -1, ‘post_type’ => ‘shop_subscription’, // Subscription post type ‘post_status’ => ‘wc-active’, // Active subscription ‘orderby’ => ‘post_date’, // ordered by date ‘order’ => ‘ASC’, ‘date_query’ => array( // Start & end date array( ‘after’ => $from_date, ‘before’ => $to_date, ‘inclusive’ => true, ), ), ) ); // Styles (temporary, only for demo display) should be removed echo ““; // Displaying list in an html table echo “ “; // Going through each current customer orders foreach ( $subscriptions as $subscription ) { $subscription_id = $subscription->ID; // subscription ID $subscription_date = array_shift( explode( ‘ ‘, $subscription->post_date ) ); // Date $subscr_meta_data = get_post_meta($subscription->ID); $customer_id = $subscr_meta_data[‘_customer_user’][0]; // customer ID $customer_name = $subscr_meta_data[‘_billing_first_name’][0] . ‘ ‘ . $subscr_meta_data[‘_billing_last_name’][0]; echo ““; } echo ‘
” . __( ‘Number ID’, ‘your_theme_domain’ ) . “ ” . __( ‘Date’, ‘your_theme_domain’ ) . “ ” . __( ‘User ID’, ‘your_theme_domain’ ) . “ ” . __( ‘User Name’, ‘your_theme_domain’ ) . “
$subscription_id $subscription_date $customer_id $customer_name
‘; }