Topic: Using Shopify reference metafields that return a GID (e.g., gid://shopify/OnlineStorePage/…) to access actual page data instead of the raw identifier.
Key update: The original issue was resolved by applying the metafield_tag filter to the reference metafield, which renders HTML for the referenced object (e.g., suitable for direct output).
General solution for data access (URL, handle, title):
Convert the GID to a Page object via pages[product.metafields.my_fields.ref_page].
Writing a solve up for the more general case here where you have a metafield returning an OnlineStorePage gid. The above will return HTML, but if you want to simply access the URL, or the handle, or title, etc, do the following:
{{pages[product.metafields.my_fields.ref_page]}} (using the above example, replace the item inside the brackets with whatever yields the OnlineStorePage gid) will give you the Page Object, which you can use to do anything you would do with a page object.