display Woocommerce subscription actions to any of custom page or dashboard

Solution:

If you want to show any of action in your custom page or dashboard then use below code and set action according to your requirements

function addCancelButton($subscription) {
    $actions = wcs_get_all_user_actions_for_subscription( $subscription, get_current_user_id() );
    if(!empty($actions)){
        foreach ( $actions as $key => $action ){
            if(strtolower($action['name']) == "cancel"){
                $cancelLink = esc_url( $action['url'] );
                echo "<a href='$cancelLink' class='button cancel'>".$action['name']."</a>";
            }
        }
    }
}
add_action( 'woocommerce_my_subscriptions_actions', 'addCancelButton', 10 );

If you want to edit My account page then i suggest to use this hook in your child theme

woocommerce_account_dashboard

Here is code for same

add_action( 'woocommerce_account_dashboard','add_account_content_kiki' );


function add_account_content_kiki() {

  if( has_active_subscription() ){ // Current user has an active subscription 

        echo '<div class="woocommerce-message woocommerce-message--info woocommerce-Message woocommerce-Message--info woocommerce-info"><a class="woocommerce-Button button" href="www.google.com">Test Now</a>Test link - shop now</div>';

    // Example of displaying something
        echo 'You have active subscription';
}

}

you have to add this function also in function file

function has_active_subscription( $user_id='' ) {
    // When a $user_id is not specified, get the current user Id
    if( '' == $user_id && is_user_logged_in() ) 
        $user_id = get_current_user_id();
    // User not logged in we return false
    if( $user_id == 0 ) 
        return false;

    return wcs_user_has_subscription( $user_id, '', 'active' );
}

Reference of hook – https://docs.woocommerce.com/wc-apidocs/hook-docs.html

All hook you can use from here for woo commerce my account page – https://businessbloomer.com/woocommerce-visual-hook-guide-account-pages/