Display Subscription id next to downloadable file at Downloads tab
-
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.
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
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.