# How Do I Return A Selected Option As Text With Markdownify?

**URL:** <https://discourse.gohugo.io/t/how-do-i-return-a-selected-option-as-text-with-markdownify/32395>\
**Category:** support\
**Created:** [April 16, 2021, 11:30am UTC](https://discourse.gohugo.io/t/how-do-i-return-a-selected-option-as-text-with-markdownify/32395 "2021-04-16T11:30:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![George\_Heginbotham](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/george_heginbotham/32/14130_2.png) [@George\_Heginbotham](https://discourse.gohugo.io/u/George_Heginbotham)\
**Post date:** [April 16, 2021, 11:30am UTC](https://discourse.gohugo.io/t/how-do-i-return-a-selected-option-as-text-with-markdownify/32395/1 "2021-04-16T11:30:06Z")

</div>

Hey guys,

In my button class I need to change the “data-item-name” to the selected text from the options tag. (Lime, orange, grapefruit or lemon) so that my cart display the name of the scent selected.

Just calling .Params.options displays all the options.

How do I go about doing this?

Currently using (on the same file)

```
{{ range $element := .Params.options }}
<select class="container">
   {{ range $element }}
    <option>{{ . }}</option>
  {{ end }}
</select>
{{ end }}

```

and  
\<button class=“snipcart-add-item btn btn-primary” data-item-id="{{ .Params.ProductID }}"  
data-item-name= “{{ .Params.options }}” {{ range first 1 .Params.Images }} data-item-image="{{ .image | absURL }}"  
{{ end }} data-item-price="{{ .Params.Price }}" data-item-url="{{ .Permalink }}" data-item-description="{{ .Description }}"\>  
Add to cart

The website is hungryhairwax.co.za

 ![Desktop Screenshot 2021.04.16 - 13.26.40.35](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/e/e5502ebb5c7b4566d380b20a262f7c7de3f47fa8.png)

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [April 16, 2021, 1:22pm UTC](https://discourse.gohugo.io/t/how-do-i-return-a-selected-option-as-text-with-markdownify/32395/2 "2021-04-16T13:22:42Z")

</div>

At that point Markdown is not in play anymore. It’s there to create the site. You need to use Javascript to work with button clicks on the final website. I am pretty sure snipcart has already solutions for that.

---

<div class="post-metadata">

**Author:** ![George\_Heginbotham](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/george_heginbotham/32/14130_2.png) [@George\_Heginbotham](https://discourse.gohugo.io/u/George_Heginbotham)\
**Post date:** [April 16, 2021, 3:24pm UTC](https://discourse.gohugo.io/t/how-do-i-return-a-selected-option-as-text-with-markdownify/32395/3 "2021-04-16T15:24:33Z")

</div>

Can you please teach me how? I struggle calling the variable inside the “data-item-name”

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [April 16, 2021, 3:27pm UTC](https://discourse.gohugo.io/t/how-do-i-return-a-selected-option-as-text-with-markdownify/32395/4 "2021-04-16T15:27:49Z")

</div>

There is a Snipcart tutorial and a Hugo test repository:

> **[Hugo Tutorial: Blazing Fast E-Commerce Stack with Forestry](https://snipcart.com/blog/hugo-tutorial-static-site-ecommerce)**
>
> Hugo is great for any website, including e-commerce. This tutorial explains how to build a blazing fast e-commerce site with Hugo, Forestry & Netlify. Buckle up!

> **[snipcart/snipcart-hugo-integration](https://github.com/snipcart/snipcart-hugo-integration)**
>
> Hugo Website Tutorial with a Live Static E-Commerce Example

More than that I don’t know.

---

<div class="post-metadata">

**Author:** ![George\_Heginbotham](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/george_heginbotham/32/14130_2.png) [@George\_Heginbotham](https://discourse.gohugo.io/u/George_Heginbotham)\
**Post date:** [April 16, 2021, 3:34pm UTC](https://discourse.gohugo.io/t/how-do-i-return-a-selected-option-as-text-with-markdownify/32395/5 "2021-04-16T15:34:57Z")

</div>

Thank you. I did some digging and I can change the scent on checkout. I’ll say “select your scent on checkout”, indirect benefit is it may result in more checkouts.
