I want to add extra column on WooCommerce admin orders list with the payment url
The url is/look like this:
https://mydomaindotcom/checkout/order-pay/17822/?key=wc_order_w4Z53iHEeYPnq
This thread is close for what i mean:
Modify woocommerce orders.php columns
This is my code attempt:
add_filter( 'manage_edit-shop_order_columns','hbm_order_key_column');
function hbm_order_key_column($columns)
{
// now it is time to add a custom one
$columns['wc_order'] = "Link Pay Order";
return $columns;
}
and this
add_action( 'manage_shop_order_posts_custom_column' , 'your_function_name2' );
function your_function_name2( $column ) {
global $the_order; // you can use the global WP_Order object here
// global $post; // is also available here
if( $column == 'custom_column' ) {
add_action( 'manage_shop_order_posts_custom_column' , 'your_function_name2' );
function your_function_name2( $column ) {
global $the_order; // you can use the global WP_Order object here
// global $post; // is also available here
if( $column == 'custom_column' ) {
//get this form other thread
$order = wc_get_order($order_id);
$pay_now_url = esc_url( $order->get_checkout_payment_url() );
echo $pay_now_url;
//http://example.com/checkout/order-pay/{order_id}?pay_for_order=true&key={order_key}
//http://example.com will be site_url and protocol will depending upon SSL checkout WooCommerce setting.
}
}
}
}
Unfortunately without the desired result. Any advice?