We are using WooCommerce Subscription and want to add a new column in the subscription overview page (/wp-admin/edit.php?post_type=shop_subscription).
We want to count all already paid renewal orders and then out put that in a column next to end date.
This is what we have so far. But it does not work
function count_paid_renewals( $subscription ) {
$get_paid_count = $subscription->get_payment_count( 'renewal' );
foreach ( $subscription->get_items() as $item ) {
?>
<tr>
<td><?php esc_html_e( 'Count: ' . $item->get_product()->get_title(), 'woocommerce-subscriptions' ); ?></td>
<td>
<?php echo esc_html( $get_paid_count ); ?>
</td>
</tr>
<?php
}
}
add_action( 'woocommerce_subscription_before_actions', 'count_paid_renewals', 99, 1 );