convert magento configurable product option dropdowns into selectable links or radio buttons

convert magento configurable product option dropdowns into selectable links or radio buttons

August 11, 2026 · Illustrated author avatarBy Stefan Bogdanescu
convert magento configurable product option dropdowns into selectable links or radio buttons

Converting Magento Configurable Product Option Dropdowns to Selectable Links

Magento’s default behavior for configurable product options is the dropdown menu, which while functional, may not always align with your store design aesthetics or user experience goals. In this guide, we’ll walk you through the process of converting those dropdown menus into selectable links styled like radio buttons.

Understanding the Default Behavior

Before we begin, let’s understand how Magento handles configurable product options out-of-the-box.

Magento uses the catalog/product_view_configurable block to output the dropdowns for each configurable option. The HTML structure looks something like this:

<div class="field field-option-select">
    <select name="super_attribute[<option_id>]" id="attr_<option_id>" data-role="opt" data-required="1" class="required-entry super-attribute-select">
        <!-- Option values as options -->
    </select>
</div>

Styling with CSS

The first step is to remove the default styling of the dropdown and apply your own.

.super-attribute-select {
    display: none;
}

.field-opt {
    list-style-type: none;
    padding-left: 0;
}

.opt-link {
    cursor: pointer;
    text-decoration: underline;
}

This CSS removes the original select element, creates an unordered list, and styles the list items as links.

Modifying the Template

Next, we need to update the template file that outputs the configurable options. For most themes, this will be located in app/design/frontend/<vendor>/<theme_name>/template/catalog/product/view/configurable.phtml.

Find the section where Magento outputs the dropdown menus:

<div class="field field-option-select">
    <select name="super_attribute[<?php echo $_option->getId() ?>]" id="attr_<?php echo $_option->getId() ?>" data-role="opt" data-required="<?php if ($_requireOption): ?>1<?php endif; ?>" class="required-entry super-attribute-select">
        <!-- Option values as options -->
    </select>
</div>

Replace it with the following code:

<div class="field-opt">
    <ul id="opt_<?php echo $_option->getId() ?>">
        <?php foreach ($_option->getValues() as $_value): ?>
            <li><a href="#" class="opt-link" data-attr="<?php echo $_value->getId() ?>"><?php echo $_value->getName() ?></a></li>
        <?php endforeach; ?>
    </ul>
</div>

This PHP code generates an unordered list with each option as a hyperlink.

Handling Click Events

Finally, we need to handle the click events for these newly created links. We’ll use jQuery for this purpose.

Add the following JavaScript code:

require(['jquery'], function($) {
    $(document).ready(function() {
        $('.opt-link').click(function(e) {
            e.preventDefault();
            var attrId = $(this).data('attr');

            // Replace this with your logic to handle option selection
            alert('Selected attribute ID: ' + attrId);
        });
    });
});

This JavaScript code prevents the default link behavior and triggers an alert when a link is clicked, displaying the selected attribute’s ID.

Conclusion

Converting Magento’s configurable product dropdowns into selectable links not only enhances the visual appeal but also improves user interaction. This guide shows you how to achieve this by modifying the template file and handling click events with jQuery.

Remember, while this is a simple solution, you may need to handle more complex logic depending on your store’s specific needs. For example, you might want to update the price, stock availability, or other product attributes based on the selected option.

If you’re looking for a comprehensive guide to Magento development and customization, be sure to check out our Magento Development Services at Laravel Company. Our team of certified Magento developers can help you implement complex features like this one while ensuring your site remains secure and optimized.

Happy coding!

Catalog Database Themes Configuration

Our network