The Purpose of Guilds in the Medieval times of the Middle Ages was originally based on the protection of the Guild members but consumers also benefited from the introduction of guilds. The purpose of the guilds were therefore twofold:
Protection for workers - the members of the Guilds
Protection for consumers
Hope this helps! :)