Since the version of WooCommerce version 3.3+ below, which displays a custom action button in the list of admin orders, no longer works.
add_action( 'woocommerce_admin_order_actions_end', 'add_custom_order_actions_button', 100, 1 );
function add_custom_order_actions_button( $order ) {
$traking_number = get_post_meta( $order->get_id(), '_aftership_tracking_number', true );
if( empty($traking_number) ) return;
$url = esc_url('https://track.aftership.com/'.$traking_number.'?');
$name = esc_attr( __('Tracking', 'woocommerce' ) );
$action = esc_attr( 'view tracking' );
printf( '<a class="button tips %s" href="%s" data-tip="%s" target="_blank">%s</a>', $action, $url, $name, $name );
}
add_action( 'admin_head', 'add_custom_order_actions_button_css' );
function add_custom_order_actions_button_css() {
echo '<style>.view.tracking::after { font-family: woocommerce; content: "\e005" !important; }</style>';
}
The code is derived from this answer: Add a custom URL link to the admin order list page in WooCommerce
What have they changed to prevent it from working in the new version?
How can I make it work in Woocommerce version 3.3+?
source
share