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