Get attribute ID in feed for variant preselection

Get attribute ID in feed for variant preselection

How can I get the ID of an (dropdown select) attribute in the product feed, rather than the label?

I'm trying to get an URL in the product feed that preselects the correct variant. Some larger size of my products are more expensive, and Google Merchant Center complains about a price mismatch.

It's possible to preselect a variant by adding the attribute and value in the URL hash, like so https://www.website.com/en/top-level-product-name.html#variant_property=property_value_id . I can probably mess around with conditional attributes and get stuff working but for one problem: selecting the attribute selects the label, and not the ID. And I need the ID for the URL to work.