Get Name of Parent Product Option to Variant

Get Name of Parent Product Option to Variant

WebSolProv
Tourist
4 0 1

Good evening,

 

I have adapted product .liquid file to show the stock quantity for each variant when changing the variant picker in the Dawn them using something along the lines of the below:

 

<p>We have <strong>{{ product.selected_or_first_available_variant.inventory_quantity }}</strong> of '{{ product.selected_or_first_available_variant.title }}' in stock</p>

 

In this case the parent option of the variant (in question) is called Pack Size, what I want to do is incorporate the words of the option itself (i.e. pack size) into the template output, something llike "We have 85 'Single' pack size in stock", but how do I get the name of the parent option when using product.selected_or_first_available_variant

 

As an example if I use product.options_with_values[0].name then I can display what I want, but I dont want to hardcode the index [0], any advice greatly appreciated.

 

Thanks

Replies 0 (0)