Rendering form for high-variant products?

Short description of issue

How to set variant_id field for high-variant products?

Reproduction steps

NA

Additional info

I’m trying to add support for high-variant products to my theme and am a bit confused by the migration steps.

According to Support high-variant products, we can no longer loop over each variant to get the list of IDs (which makes sense).

Where, then do the variant IDs come from? Is it expected that we retrieve variant IDs via ajax every time the user changes their option selection? Is there a way to perform an Add To Cart action using only the selected option IDs, without requiring a variant ID?

What type of topic is this

Troubleshooting

Hello @rpbiwer,

I think it is indeed expected for you to use AJAX APIs to get all the data you need. Where you source the data is a decision for you.

You can, for example, introduce the variant ID in your markup leveraging the {{ product.selected_variant.id }} Liquid property

When fetching via the Section rendering API (i.e /products/handle?section_id=id&options_values=value1,value2), it should return the variant ID :wink:

Hope it helps !

A bit disappointing but I guess that’ll have to do. Thanks!

1 Like