I Would like to add some CSS to the order admin page to hide a custom order action button, but only if the order contains only downloadable products.
This is the function I need to load conditionally:
add_action( 'admin_head', 'hide_custom_order_status_dispatch_icon' );
function hide_custom_order_status_dispatch_icon() {
echo '<style>.widefat .column-order_actions a.dispatch { display: none; }</style>';
}
Is that possible?
With CSS it's not be possible.
Instead you can hook in
woocommerce_admin_order_actions
filter hook, where you will be able to check if all order item are downloadable and then remove the action button "dispatch":Code goes in function.php file of the active child theme (or active theme).
This is untested but should work…