Hi @gendai,
For sorting the order of Global Attributes which are added from Product > Attributes you can drag and drop those into the order you would like them to display.
For custom attributes added from the Product Edit screen itself, you should add the values in the order you would like to display.

Image Link: https://cloudup.com/ccFH7rQdPVe
Thread Starter
gendai
(@gendai)
Hi
Thanks, but I’m looking to sort on the front end. Otherwise I need to modify 180 items to set the order of all the attributes. The values of the attributes or fine, they don’t need any sorting.
What i’m looking for:

Hey @gendai,
The process for sorting both types of attributes on the frontend of a product page within WooCommerce is described within my initial reply.
Below is an example of the display sorting of custom attributes created on a products edit screen.
Attributes

Image Link: https://cloudup.com/cnHxK0-ddwv
Product Page Display

Image Link: https://cloudup.com/cz9T18s1l1c
If you’ve created attributes from Products > Attributes this blog post may help when sorting those.
https://devanswers.co/change-woocommerce-variations-attributes-custom-sort-order/
Thread Starter
gendai
(@gendai)
Hi @stuartduff
It’s now more clear for me that I can do this manually, and sorting of the values also works for me.
Since I have around 180 product with attributes I would like to sort the attributes by id or name, so a fix sorting. The attribute values are not important. Can this be done with a script (snipped), so I don’t have to edit all the products? Ifso can you point me in the right direction?
Sorry if I was not clear with the first post.
Hey @gendai,
What you could try is exporting the product to a CSV file. Then edit that CSV file attributes and reimport them again. This would only work for custom attributes added on the product edit screen.
https://docs.woocommerce.com/document/product-csv-importer-exporter/
It’s always good practice to create a full backup of your site using service like Jetpack Backup or a plugin like UpdraftPlus before updating software or performing any other operations, in general, which may change a site’s files or database.
Global Attributes would need to be manually sorted by drag and drop using a custom sorting order.
Hi there,
I hope you found the previous reply helpful. We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.