You don’t mention how far off the stud location is vs desired mounting location. And as Feldman brought up, is this an interior or exterior wall? An exterior wall will be much more solid as an interior wall can still transfer foot fall. Another consideration is whether outlet boxes are on the side of the stud that you would be adding the new stud, also will you have horizontal runs of Romex wiring to negotiate.
If your current studs are only a few inches off from desired location, would you consider a horizontal brace fastened to the wall and then mount the shelf to it. You could cut the length to have equally balanced extensions on each end if possible finish to match and it would appear to be part of the original design. It would also help to know the make of the shelf so we could see the design.
If your current studs are only a few inches off from desired location, would you consider a horizontal brace fastened to the wall and then mount the shelf to it. You could cut the length to have equally balanced extensions on each end if possible finish to match and it would appear to be part of the original design. It would also help to know the make of the shelf so we could see the design.