2

I have configurable products with many attributes like size and color in v2.2.7.
They are listed in the admin area and in Stores > Attributes > Attribute Set > Default.
The order currently is "Size", then "Color".

But on the customers view for the product, attributes are listed as "Color" and then "Size".

enter image description here

This post in the magento forums outlines how to do it while creating a configurable product. However, if products are already created and you go to configuration options, there is not a way to edit attributes order without also recreating all configured products.

Making the change suggested in "Stores > Attributes > Product > Storefront Properties" from this post, changes the order of how things show up in layered navigation. But it doesn't change the order of configuration options the customer sees.

I'm trying to make "Size" appear above "Color" when customer is looking at product page. How do I change the order of configuration options for products already created?

UPDATE

  • The order attributes show up in customer view / layered navigation is changed from Stores > Attributes > Product > [attribute] > Storefront Properties > [Position].
  • The order configuration options show up in customer view / product details page are controlled by position column in the catalog_product_super_attribute table (see accepted answer).
  • The order attributes show up in admin section when adding new products is based on the order in Stores > Attributes > Attribute Set > [set] > [Groups]. Note that custom attributes added to the "Product Details" group don't always follow the order in v2.2.7. So it's best to click "Add New" under Groups and add the custom attributes you need to show up in a set order during product on-boarding to the group you created.

2 Answers 2

13

The position of the attributes of Configurable Product are stored at catalog_product_super_attribute

Use SQL to update position in PDP

192 = Id attribute Size
193 = Id Attribute Color
update catalog_product_super_attribute set position = 1 where attribute_id = 192 AND product_super_attribute_id <> 0;
update catalog_product_super_attribute set position = 2 where attribute_id = 193 AND product_super_attribute_id <> 0;

update:

Where you can find attribute id => You can look up in the table named eav_attribute

select attribute_id from eav_attribute where attribute_code = '[attribute code]';
5
  • Thank you! Please include update style that will work with mysql workbench safe mode, example: UPDATE catalog_product_super_attribute set position = 1 WHERE attribute_id = 193 AND product_super_attribute_id <> 0; and that to find the attribute_id needed, look in eav_attribute table for the attribute_id corresponding to the names (attribute_code's) to that should be updated.
    – jtlindsey
    Feb 14, 2019 at 15:44
  • Updated my answer.
    – HoangHieu
    Feb 15, 2019 at 2:22
  • Hi @HoangHieu, Your solution is working fine. But once you edit the product from admin, it lost its position again. Can you provide a permanent solution for it? Thank you Nov 20, 2019 at 10:27
  • Hi @SanchitGupta, I thought these attributes you are selected didn't order. Think you're selected Color -> Size (then the order is Color -> Size), you need to select Size first if you want to Color is next to Size.
    – HoangHieu
    Nov 20, 2019 at 14:23
  • Hi@HoangHieu! you are correct. Upvoted :) Happy coding Dec 2, 2019 at 7:42
3
  • Go to Product page (Admin)
  • Configurations then Edit Configurations
  • Click Next to set attribute value
  • Drag Color after Size enter image description here

  • Hit Next until Generate products

  • Save your product and Reindex cache
  • Check on frontend

For future products attributes sorting

  • Goto Store -> Attributes -> Products
  • Open your desired Attribute
  • Open tab Storefront Properties
  • Set Position value here
  • Example: 10 for size, 20 for color
2
  • what am I missing about your post? It looks like you read my post and re-posted how to perform steps I already outlined and linked to. You didn't address the problem of how to "change the order of configuration options for products already created". Your steps only affect layered navigation...which I already pointed out in my original post and the page to set position clearly states "Position of attribute in layered navigation block." is what it's for.
    – jtlindsey
    Feb 14, 2019 at 15:17
  • The steps that I have shared can apply on current products too. It's ok, @HoangHieu resolve your issue this is important :) Feb 14, 2019 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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