dropdown for product variant picker

main
alexanderroese 2024-07-13 18:37:26 +02:00
parent 1701589228
commit fb3d7a4305
1 changed files with 7 additions and 4 deletions

View File

@ -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;