5

I want to change the sort order of size swatches.

I have already put it in sort order from admin but I could not see any result in the front side.

Actual Result

enter image description here enter image description here

Expected Result

enter image description here

How can I sort it as per my expected result.

3
  • 1
    Did you try indexing? Sep 24 '18 at 13:40
  • 1
    yes, I have clear cache and reindex @Divyarajsinh
    – Jaimin
    Sep 24 '18 at 13:40
  • Now you can not see result in frontend. For that you need to customize code or else delete attribute and create new with proper sort order. Nov 12 '19 at 11:10
0

Yo! Yo! Find a Solution! Also see
Swatch Option Not showing in ASC order in Magento2

Open File

vendor/magento/module-configurable-product/Model/ResourceModel/Attribute/OptionSelectBuilder.php

Add Below code on after line no. 93
)->joinInner( ['attribute_option' => $this->attributeResource->getTable('eav_attribute_option')], 'attribute_option.option_id = entity_value.value', [] )->order('attribute_option.sort_order ASC'

enter image description here

Note: You need to set position of swatch in admin

1
  • right answer! minus point lol Nov 29 '19 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.