An interesting question, that I will try to answer briefly. Synecdoche is closely related to metonymy - a term used for one thing being applied to another- synecdoche is really a subclass of metonymy. It is very closely connected to the metaphor and the plot of Hamlet is riddled with synecdoches:
'Old Hamlet's grizzled hand, Hamlet's 'inky cloak,' Ophelia's flowers, Yoricks skull and the envenomed point that kills Hamlet are all examples. Look at Claudius' speeches both in private and public, he uses synecdoche a lot - one example being the kingdom 'contracted in one row of woe.'
Hamlet and Claudius use synecdoche in different ways, which symbolises the differences between them. - hope this helps!