4 digits 7s display + 74HC595

int digits_number = 4;
int bytes = B0001;

Are these variable types reasonable, given the size of the value being stored in them?

 const int latchSegments = 7;
 const int clockSegments = 6;
 const int dataSegments = 5;
 
 const int latchDigits = 8;
 const int clockDigits = 9;
 const int dataDigits = 10;

Are these?

     int d1 = 1;
     int d2 = 2;
     int d3 = 3;
     int d4 = 4;

Are these?

Why is there no data in the digits array to represent all segments off (i.e. display nothing in this position)?

What, exactly, are you attempting to display?

The switch inside the for loop looks pretty stupid. On any given pass through the loop, only one of the 4 cases will ever be executed, and the loop only makes 4 passes, executing the cases in order. Get rid of the for loop and the switch statement and cases. Just execute the 4 instructions in order.