Disable Order Status Emails During Bulk Updates
When you update multiple orders at once using the bulk actions feature in WordPress, Sunshine Photo Cart sends an order status email to each customer whose order is updated. While this is helpful in most cases, some photographers prefer to handle these updates quietly without triggering automated emails—especially when making administrative corrections or organizing orders behind the scenes.
When You Might Need This
You may want to use this customization if you:
- Frequently organize or reclassify orders in batches without needing to notify customers
- Make administrative status changes that don't require customer communication
- Prefer to manually email customers about important updates rather than using automated emails
- Are migrating or cleaning up old orders and don't want to confuse customers with emails
This customization only affects bulk updates. When you manually change an individual order's status one at a time, you can choose to notify the customer.
/**
* Disable Sunshine Photo Cart order status emails during bulk updates
*/
add_action( 'load-edit.php', 'sunshine_disable_bulk_order_emails' );
function sunshine_disable_bulk_order_emails() {
// Only run on the Sunshine orders screen
if ( ! isset( $_GET['post_type'] ) || $_GET['post_type'] !== 'sunshine-order' ) {
return;
}
// Check if a bulk action is being performed
$wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
$action = $wp_list_table->current_action();
// Check if this is a Sunshine order status bulk action
if ( $action && false !== strpos( $action, 'sunshine_order_status_' ) ) {
// Remove the order status email hook during bulk updates
$email_instance = SPC()->emails->get_email_by_id( 'order-status' );
if ( $email_instance ) {
remove_action( 'sunshine_admin_order_status_update', array( $email_instance, 'trigger' ) );
}
}
}
Learn how to add this custom code to your WordPress website
Still need help?
If you have not yet found your answer in the documentation articles, please contact support