Product ID Filter

Note: This requires the PW Bulk Edit Pro version.

It is possible for you to hook into the Bulk Editor to add a filter for Product ID. Follow these instructions:

If you are more comfortable with editing your functions.php you can do that instead of Code Snippets.

1. Download the free Code Snippets plugin https://wordpress.org/plugins/code-snippets/
2. Create a Snippet with the following code:

function pwbe_filter_types_product_id( $filter_types ) {
    $filter_types['post.ID'] = array( 'name' => 'Product ID', 'type' => 'numeric' );

    return $filter_types;
}
add_filter( 'pwbe_filter_types', 'pwbe_filter_types_product_id' );

function pwbe_common_fields_product_id( $common_fields ) {
    global $wpdb;

    $common_fields .= ",
        post.ID AS product_id
    ";

    return $common_fields;
}
add_filter( 'pwbe_common_fields', 'pwbe_common_fields_product_id' );

function pwbe_where_clause_product_id( $row_sql, $field_name, $filter_type, $field_value, $field_value2, $group_type ) {

    if ( in_array( $field_name, array( 'post.ID' ) ) ) {
        $sql_builder = new PWBE_SQL_Builder();
        $row_sql = $sql_builder->numeric_search( $field_name, $filter_type, $field_value, $field_value2 );
    }

    return $row_sql;
}
add_filter( 'pwbe_where_clause', 'pwbe_where_clause_product_id', 10, 6 );
Skip to content