Hi Zoe,
1- Yesterday, it took Scott half an hour to return from the supermarket after doing his shopping.
2- Yesterday, it took Scott half an hour to return from the supermarket after having done his shopping. Just as the perfect tenses focus on 'the past in so far as it has importance for a later time', so does the perfect participle. We see this more clearly in a sentence like 'Having worked on his homework for three hours, he felt very tired'. In your example, it's just a subtle difference in focus, in emphasis you might say. It shows a little bit more which time frame the speaker has in his/her mind.
Best wishes, Clive