Using custom metaobjects as an option

I noticed that I can use custom metaobjects as an option for the product, but it doesn’t seem to use any other fields except the name.
I expected to have at least some access. For example, I want to add an image of the material and some small pattern that will be displayed on the option or some other additional information and use it in the liquid. i tried to output json but it only returns the name.

In other words, I would like to have the same capabilities as the color metaobject, but add a few more custom fields for greater customization

If you’re looking to enhance your Shopify product options with custom metaobjects, the key is ensuring that Shopify properly links these metaobjects to your product options. By default, Shopify only returns the name of a metaobject when used as an option, but we can work around this by querying the metaobject fields directly in Liquid, using metaobject references in the product template, or leveraging metafields to store additional attributes like images and patterns. If Liquid alone isn’t enough, Shopify’s GraphQL API can retrieve more detailed metaobject data dynamically.

We can help you set this up properly—whether it’s configuring metaobjects, optimizing Liquid templates, or using Shopify’s API for deeper customization. Our expertise ensures that your product options display exactly the way you envision, with all the additional data you need. Let’s work together to get this implemented seamlessly in your stoe!

So you propose to go directly to the metaobject and check if the name matches and if so, use the value?
I don’t need help because I’m a developer myself and I was wondering how to use this, thanks for the suggestion

in product-variant-picker.liquid need add

{%- liquid
  # Get option handle name
  assign handle_name = option.name | handleize
  # Get meta swatch count
  assign meta_swatch_count = product.metafields.option[handle_name].value | map: 'image' | compact | size
  assign meta_swatch_count = product.metafields.option[handle_name].value | map: 'color' | compact | size | plus: meta_swatch_count
  assign swatch_count = option.values | map: 'swatch' | compact | size
  assign picker_type = block.settings.picker_type

  # Counting the number
  if block.settings.swatch_shape != 'none' and swatch_count > 0 or meta_swatch_count > 0
    if block.settings.picker_type == 'dropdown'
      assign picker_type = 'swatch_dropdown'
    else
      assign picker_type = 'swatch'
    endif
  endif
-%}

in product-variant-options.liquid i replaced swatch.value with swatch_value and add:

{%- for value in option.values -%}
  {%- liquid
    assign handle_name = option.name | handleize
    assign meta_value_swatch = product.metafields.option[handle_name].value | where: 'label', value | first
    assign value_swatch = value.swatch | default: meta_value_swatch

After these changes, the Dawn theme perceives my custom swatch as a regular one and I can additionally get the values I need