Exclude Suspended Vendors from Announcement Email

By default, clicking “select all” vendors for the announcement will include your suspended vendors as well. On my site, I suspended certain vendors for a reason, and did not feel it was appropriate to contact them with things like site updates during that time. So if you would like the default behavior to only include active vendors, simply add this code to your child theme’s functions.php file:

add_action('add_meta_boxes', 'wcmp_remove_meta_boxes',99);
function wcmp_remove_meta_boxes() {
    remove_meta_box('wcmp_vendor_notice_select_vendor', 'wcmp_vendor_notice', 'side');
            __( 'Vendors', 'dc-woocommerce-multi-vendor' ),
function wcmp_vendor_notice_select_vendor_callback() {
    global $post;
    $selected_vendors = (array)get_post_meta( $post->ID, '_wcmp_vendor_notices_vendors', true );
    wp_add_inline_script( 'wcmp_admin_js', '( function( $ ) {
            placeholder: "'.__('Select vendor...', 'dc-woocommerce-multi-vendor').'"
            $("#show_announcement_vendors > option").prop("selected","selected");
    } )( jQuery );' );
    <div class="announcement-vendors-wrap">
        <select id="show_announcement_vendors" name="show_announcement_vendors[]" class="" multiple="multiple" style="width:100%;">
            $vendors = get_wcmp_vendors();
            if ($vendors){
                foreach ($vendors as $vendor) {
                $is_suspended =get_user_meta( $vendor->id, '_vendor_turn_off', true);
                    if( !$is_suspended ){
                        $selected = in_array($vendor->id, $selected_vendors) ? 'selected' : '';
                        echo '<option value="' . esc_attr($vendor->id) . '" '.$selected.'>' . esc_html($vendor->page_title) . '</option>';
            <button type="button" class="button button-default" id="anv_select_all"><?php _e( 'Select All', 'dc-woocommerce-multi-vendor' ); ?></button>
            <button type="button" class="button button-default" id="anv_reset"><?php _e( 'Reset', 'dc-woocommerce-multi-vendor' ); ?></button>

Tested and working on Woocommerce 4.6.1, WCMp 3.5.10

Is this no longer relevant or not working? Please let us know in the comments!

Comments on this post

Your email address will not be published. Required fields are marked *