How to sort and order WooCommerce products by Custom Attributes

To add extra sorting options to your WooCommerce pages using products’ meta data you can use the following

However, we wanted to add some sorting options that use the WooCommerce’s custom attributes. According to this thread, the product attributes are saved in a serialized format in the database and therefore it’s not feasible to do it directly using WordPress orderby attribute. Read More