• Resolved costas96

    (@costas96)


    Hello. I am trying to add an extra column to display the subscription id next to the downloadable file. I am using the following code to add the column:

    function add_woocommerce_account_downloads_columns( $actions ) {
     
        $actions = array(
            'download-product'   => __( 'Product', 'woocommerce' ),
            'download-remaining' => __( 'Downloads remaining', 'woocommerce' ),
            'download-expires'   => __( 'Expires', 'woocommerce' ),
            'download-file'      => __( 'File', 'woocommerce' ),
            'download-actions'   => ' ',
            'download_subscription_id'   => __( 'Subscription', 'woocommerce' ),
        );
     
        return $actions;
    }

    and the following code to populate the column:

    add_action( 'woocommerce_account_downloads_columns', 'webroom_add_wc_order_admin_list_column_content' );
     
    function webroom_add_wc_order_admin_list_column_content( $column ) {
       
        global $post;
     
        if ( 'download_subscription_id' === $column ) {
     
            $download = wc_get_subscription( $post->ID );
            echo '<p>Sub: ' . $download->get_subscription_id() . '</p>';
          
        }
    }

    I guess I am doing something wrong with the filters and the action. Any suggestion would be appreciated. Thank you.

    • This topic was modified 3 years, 10 months ago by costas96.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    Hey @costas96,

    This blog article displays a more compact way of adding columns to the My Account > Downloads section of WooCommerce. It also includes an example of how to then add data for any additionally added custom columns.

    https://codedcommerce.com/product/add-or-change-columns-on-digital-download-tables/

    With regards to fetching subscription ID data if you require some assistance with that, you could hire a developer to help create that portion of the code. If you would like to investigate that possibility further, you could reach out to some of the official WooCommerce development partners via this link below.

    https://woocommerce.com/customizations/

    I hope this helps.

    Plugin Support abwaita a11n

    (@abwaita)

    Hi,
    We’ve not heard back from you in a while, so I’m marking this thread as resolved. Hopefully, the above info was helpful!

    If you have further questions, please feel free to open a new topic.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display Subscription id next to downloadable file at Downloads tab’ is closed to new replies.