Variant selector

Questions & AnswersCategory: QuestionsVariant selector
Ainoa asked 2 years ago

We are starting to test the script and first of all want to say thanks, it can save us so many time!!
We are migrating from Woocommerce to Squarespace and needed an alternative to WPML. Your plugins seems to be the solution.
So now the issue, I’ve found the script is not filtering a translation in a variant selector of product pages:
Here closed:

And open:    

Using the standard script plus the hard-coded-text script, “SIZE” is translated to “TALLA” and “Select size” is translated to “Select talla” but just when is open. Probably because the closed state text it’s in a data-text property:

<div class="variant-select-wrapper" data-text="Select Size" id="yui_3_17_2_1_1494158974426_315">
<select data-variant-option-name="Size" id="yui_3_17_2_1_1494158974426_214">
<option value="">Selecciona Talla</option>
<option value="10">10</option><option value="12">12</option><option value="14">14</option>



1 Answers
Ainoa answered 2 years ago

Solved it by adding this to the hard-coded-text script:

jQuery(".variant-select-wrapper").each(function() {
 jQuery(this).attr('data-text', 'Seleccionar');


Dave Hilditch replied 2 years ago

nicely done!