Thanks Tim, I think you’re right!
As a follow-up, the solution turned out even more convoluted than we had imagined.
We have a theme object stored on the window, so we added the taxonomy IDs with the base sizes to that, eg.
window.theme = {
baseSizes = [
{
"id": "gid://shopify/TaxonomyValue/2880",
"name": "10"
}
];
}
On PDP, we have a small script that gets all of the taxonomy IDs from the products category metafield, eg.
And then we do the logic to match the IDs to the option labels and get the base size and then append the base size to the exsting labels.
Then the PLP. Thinking we could use the collection filters like this:
assign sizeFilter = collection.filters | where: 'name', 'filter.v.t.shopify.size' | first
assign sizeFilterValues = sizeFilter.values
and then get the values and labels to get a list of the taxonomy IDs with their base sizes, respectively.
This works but then when you try to access the metaobjects based on their handles in order to access their labels, you run into the issue that you can only access a max. of 20 unique metaobjects via handle, and of course you can only loop through 50 of them, so that’s not an option either.
So you accept that this has to be done with JavaScript as well, sigh… So then we added a script to our product grid item template that fixes things for the PLP.
But now you remember that anywhere these templates are injected, in our case for quick add modals and related/recommended product sections, these scripts won’t run. So then you add some JS in your theme JS file to map sizes in the relevant places using the global object created earlier.
Then rinse and repeat for shoe sizes!
So, to finish on a constructive note - could we please have something like this:
{{ variant_option.linked_metafield }}