dahlsdata-tahira
dahlsdata-tahira

Reputation: 359

WooCommerce how to remove order actions (WordPress)

When you view an order in back-end there is a drop down list a the right side "Order actions". I was wondering how to remove some of these actions? I just need "Resend Processing order" - everything else should be removed.

Screenshot

I have done a Google-search but mostly the results show how to add custom order actions and not how to remove them.

Thanks!

Upvotes: 3

Views: 2769

Answers (2)

Nicholas
Nicholas

Reputation: 31

add_filter( 'woocommerce_order_actions', 'woocommerce_remove_order_actions' );
function woocommerce_remove_order_actions( $order_emails ) {
    unset($order_emails['regenerate_download_permissions']);
    return $order_emails;
}

I see that this has not been resolved 100%. You can use the woocommerce_order_actions hook and unset elements you don't want to see in that dropdown.

Upvotes: 3

Reigel Gallarde
Reigel Gallarde

Reputation: 65264

well, this should do it.

add_filter( 'woocommerce_resend_order_emails_available', 'woocommerce_resend_order_emails_available' );
function woocommerce_resend_order_emails_available( $order_emails ) {

    //$order_emails has array( 'new_order', 'cancelled_order', 'customer_processing_order', 'customer_completed_order', 'customer_invoice' );

    $remove = array( 'new_order', 'cancelled_order', 'customer_completed_order', 'customer_invoice' ); // remove these 4
    $order_emails = array_diff( $order_emails, $remove );

    return $order_emails;

}

Upvotes: 2

Related Questions