Magento 2 sort product in catalog product list based on product attribute option position

I am working with Magento 2, I need to sort the product on category page based n product attribute.

  1. Product attribute type is dropdown.
  2. I will sort the option while creating attribute.

Now in front if I select this attribute product should sort based on option position.

Example :
Product Attribute name : Test

Attribute type is dropdown.
Option 1: sort1
Option 2: sort2

I have two products. Both has diff value assign. Now if I change the options position it should sort accordingly in frontend.

Thanks in advance.


Go to Source of this post
Author Of this post: David Coder
Title Of post: Magento 2 sort product in catalog product list based on product attribute option position
Author Link: {authorlink}