dropdown for product variant picker
parent
1701589228
commit
fb3d7a4305
|
@ -143,7 +143,12 @@
|
|||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<button class="shx-custom-dropbtn" id="shx-custom-selected">Produktvariante auswählen</button>
|
||||
<button class="shx-custom-dropbtn" id="shx-custom-selected">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center">
|
||||
<span>Produktvariante auswählen</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#131213"><path d="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"/></svg>
|
||||
</div>
|
||||
</button>
|
||||
<div class="shx-custom-dropdown-content" id="shx-custom-dropdown-content">
|
||||
{% for product_variant in product.variants %}
|
||||
<div data-value="{{ product_variant.title }}">
|
||||
|
@ -168,9 +173,7 @@
|
|||
item.addEventListener('click', event => {
|
||||
const selectedVariant = event.currentTarget.getAttribute('data-value');
|
||||
selectedButton.innerText = event.currentTarget.innerText;
|
||||
|
||||
console.log("selEl", selectElement, selectedVariant)
|
||||
|
||||
|
||||
// Set the selected option in the original select element
|
||||
selectElement.value = selectedVariant;
|
||||
|
||||
|
|
Loading…
Reference in New Issue