You should learn the Arduino "bit" macros:
https://www.arduino.cc/reference/en/language/functions/bits-and-bytes/bitset/
For example, you have a byte variable that holds the staes of your relays named "relayStates" and you wanted to change the state of relay 4 from OFF to ON.
bitSet(relayStates,4);
To turn relay 7 OFF:
bitClear(relayStates,7);
Then send "relayStates" to the shift register.
1 Like