Thank you so much for sharing this.
Is there a way to modify this snippet to hide all Custom Attributes from view? We only want to display the global attributes on the product pages.