Change Sort Order of Magento Attribute Options (Values) and Dropdowns
Configurable product type is a perfect tool to offer products with options for your customers. Although the creation of configurable products in Magento is pretty straightforward, you may find it tricky to set the order of options in a dropdown (like place size options from XS to XXXL) and the order of dropdowns themselves (for example, place color, size, and fabric characteristics in exactly this order).
Below you'll find solutions to both these tasks.
The order of options (Magento attribute values) in an dropdown is configured in the attribute properties. You can sort the options while creating an attribute or by editing the properties of an existing attribute.
To sort the options of an existing attribute in the Magento admin, go Menu > Stores > Attributes > Products.
Select an attribute and click it to enable the editing mode. In the Properties tab, you’ll see the attribute options. Drag the options to arrange them as you need.
As you can see, options values are set in the attributes properties, not the product properties. It means that options can’t be configured for an individual product and that all configurable products created with the same attribute will have the same options order in the dropdown.
If you have many options (values), sorting them via import will be much faster than manual drag-and-drop. As Magento native import can be rather tricky, we’d recommend using the Store Manager for Magento export/import tool for the task.
Store Manager is a downloadable application that enhances the default Magento functionality with tools for bulk edits, seamless import/export, database backup, data generation, and others.
If you don’t have Store Manager yet, download a free trial and install it on your computer. Connect the application to your store database and enjoy the simplicity of your store administration.
Here are the steps to update sort order of options in a dropdown:
- Export an attribute with values to a file. In Store Manager, go to Menu > Catalog > Attributes. In the list of attributes, select the one you need to sort options for. In the attribute window, switch to the Manage Options tab and click Import/Export Options.
- Open the file in a spreadshet editor, arrange the options as needed and save the changes.
- Import the file back with the setting Add and Modify.
Follow the steps of the export wizard and save the file to your computer.
As you can see, positions of options have been updated:
As you can see, arranging the order of attribute options is pretty straightforfard. Though if you need to change the order of attributes (with dropdowns) on the product page, you won’t find such a possibility in the Magento 2 admin (though it was available in Magento 1). Luckily, you can solve this task quite easily and without coding via the Store Manager for Magento application.
Launch Store Manager for Magento and go to Catalog > Categories&Products. Select a product, move down to the lower grid and switch to the Associated products tab. In the Super Product Attributes Configuration section you can set the positions of attributes:
If the position is 0 for all attributes, they will be sorted in alphabetical order.
If you want to edit attributes sort order for multiple configurable products, you can do it in a few clicks using the flexible import tool with Store Manager for Magento. Let's see how it works.
Here is a sample product with two options, color being the first on the list and size being the second.
Here is a file that we've prepared for import. As you can see, it has only four columns:
- Product identifier (SKU, ID)
- Column with SKUs of associated to configurable simple products (column 2 at the screenshot)
- Configurable attributes (color and size)
- Attribute position of configurable products where you indicate numbers that correspond to sort order of attributes in previous column.
Note: All the multiple values in the file are separated by a delimiter, in our case, it is a comma (,) symbol.
You will have to indicate the delimiter (the one you use in your file) at the appropriate step of the Import Wizard.
If you are uploading new configurable products with associated items, you need to include more fields in your import file. Check this step-by-step tutorial on how to create Magento 2 configurable products via import.
Let’s see what we have got as a result.
As you can see, attribute dropdowns for this Magento configurable products are now displayed in correct order.
Change Sort Order of Magento 2 Attribute Dropdowns with Store Manager Download FREE trial
Massively Associate Child Simple Products to Main Configurable via Import to Magento
Check how to link simple products to configurables when the simple products are already created and in the case they need to be previously created; get the csv samples. Read More...
Simple Products with Custom Options VS Configurable Products
Detailed comparizon of Magento configuable products and Magento simples with custom options. Read More...
Magento Configurable Products VS Magento Grouped Products
Check the detailed explanation of how to distinguish Magento configurable products from Magento grouped products. Read More...
Upload Magento Swatch Images to Configurable Products
Get the full explanation of Magento swatch images and their purpuses and find out the ways to assign them to products via admin and Store Manager. Read More...
Thanks for your tutorial!