• Resolved Melanie van Oers

    (@melanie-van-oers)


    In Woocommerce I created a variable product with different attributes and variations. Woocommerce generates the following code in a dropdown on the front:

    <select id="pa_breedte" class="" name="attribute_pa_breedte" data-attribute_name="attribute_pa_breedte" data-show_option_none="yes">
    <option value="">Een optie kiezen</option>
    <option value="205-cm" class="attached enabled">205 cm</option>
    <option value="290-cm" class="attached enabled">290 cm</option>
    <option value="375-cm" class="attached enabled">375 cm</option>
    </select>

    The value of the options is the slug of the specific attribute (for example the value of the option 205 cm is 205-cm) Instead I want the value to be the name of the attribute (so I want the value of 205 cm to be the same as the name 205 cm).

    I searched the whole woocommerce plugins codes, but can’t find the specific code where I can change the Slug in to the Name.

    Can somebody help?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Fernando a11n

    (@fhaps)

    Automattic Happiness Engineer

    Do you understand correctly that you want the slug to be 205 cm instead of 205-cm?

    If so, I’m afraid that isn’t possible. Slugs cannot have blank spaces, which is why a - is placed in there.

    Thread Starter Melanie van Oers

    (@melanie-van-oers)

    Hej @fhaps,

    I don’t want to change the slug, because I understand these can’t have blank spaces. But I hope it is possible to change slug to name in the code.

    Hopefully for better understanding:
    Now the code is something like:

    <select>
    <option value="SLUG">NAME</option>
    </select>

    I’d rather have:

    <select>
    <option value="NAME">NAME</option>
    </select>

    Therefor I need to change the woocommerce code, but I can’t find the lines where this code is generated.

    I hope I explained myself correctly, I’m not a native English speaker.

    Plugin Support Fernando a11n

    (@fhaps)

    Automattic Happiness Engineer

    I don’t have much advice when it comes with the actual code of making the change. I’ll leave this thread open for now, and see if you get any other suggestions from the community.

    Note that it might be helpful if you are able to elaborate on what the use case for this, or why is the change needed. That might inform other people while reading this and help them come up with a potential solution.

    Plugin Support Fernando a11n

    (@fhaps)

    Automattic Happiness Engineer

    We haven’t heard back from you, or other users, on this thread for a while, so I’m going to close this now.

    As mentioned above, something like this would require customization work. If you are interested in hiring a developer who can look at this more closely, you may want to contact one of WooCommerce’s customization partners at the following link:

    https://woocommerce.com/customizations

    If you have any further questions, feel free to start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change dropdown (select) value slug to name of attribute variations Woocommerce’ is closed to new replies.