GCSE grades are important but not conclusive. Your predicted IB score will be far more important. Now with St Andrews, you need to ignore their stipulated grade requirements as most applicants achieve A/A*s across the board. The challenge with St Andrews is actually getting the offer in the first place as it has roughly 25% offer rate. The bigger question is where you are applying from. If you are Scottish, the chance of you getting in is far lower than if you are international. Roughly speaking, Scottish offer rate is 10-15%, RUK (rest of UK) 25-30%, international is roughly 65%. St Andrews acceptances are based on some merit, but like with every competitive university, luck and situation are also large factors. Your GCSEs are not an issue if you get good IB predicted grades, however things like your personal statement, international status and other possibly political aspects and luck are just as important if not more so.