• Resolved situl

    (@situl)


    Hi there

    I’ve created a global attribute on my website called “Sizes”, and for this attribute I have selected to order all terms by Term ID. I am uploading all sizes that I will be using on my website using Python and the Woocommerce REST API. I can upload the sizes from my Python Script to my website, but the website isn’t ordering the Sizes according to Term ID.

    Instead, order by Term ID is ordering the Items exactly the same as Ordering them by Name.

    Has anyone had a similar problem to this and does anyone know what is causing this? Have I misunderstood what is meant by “Sort by Term ID”? There are a few caveats to add:

    1) I am sure that my Term ID is correct. I upload the sizes in a specific order, and thus WooCommerce assigns a Term ID based on the order that they are uploaded to the website. I can verify what the Term ID is for each “Size” by either viewing them in the SQL Database, or by using the API to retrieve, and I can confirm they are not in the Term ID order, either ascending or descending order. Instead they are sorted via Name
    2) I have a feeling people might suggest using a custom sort instead. However, I’m reluctant to do this because I will have probably over 200 sizes to sort, and I would like to replicate the sizes and ordering to additional websites so it would be better for me to have one script that I could deploy to each website to then get the sizes uploaded in right order.

    Finally, to show you what is happening, here are the sizes and order I am uploading to the website:

    Sizes in the order I’m Uploading
    “Newborn”, “3 Months”, ‘6 Months’, ‘9 Months’, ’12 Months’, ’18 Months’, ‘2 Years’, ‘3 Years’, ‘4 Years’, ‘5 Years’, ‘6 Years’, ‘7 Years’, ‘8 Years’, ‘9 Years’, ’10 Years’, ’11 Years’, ’12 Years’, ’13 Years’, ’14 Years’, ’15 Years’, ’16 Years’, ’17 Years’, ’18 Years’, ‘XXS’, ‘XS’, ‘S’, ‘M’, ‘L’, ‘XL’, ‘XXL’, ‘XXXL’

    Order sizes are appearing in the Attributes Section
    10 Years, 11 Years, 12 Months, 12 Years, 13 Years, 14 Years, 15 Years, 16 Years, 17 Years, 18 Months, 18 Years, 1test, 2 Years, 3 Months, 3 Years, 4 Years, 5 Years, 6 Months, 6 Years, 7 Years, 8 Years, 9 Months, 9 Years, L, M, Newborn, S, testalpha, XL, XS, XXL, XXS, XXXL

    Note I added in 1test and testalpha directly through Woocommerce just to see if these would be added to the end of the list if I retained “Sort by Term ID”, they didn’t and were added into the section alphabetically according to “Sort by Name”.

    Just to add to this, if I pull up the term details for the size Newborn and 10 Years, it shows the following:
    Newborn
    {‘id’: 532, ‘name’: ‘Newborn’, ‘slug’: ‘newborn’, ‘description’: ”, ‘menu_order’: 0, ‘count’: 0}
    10 Years
    {‘id’: 546, ‘name’: ’10 Years’, ‘slug’: ’10-years’, ‘description’: ”, ‘menu_order’: 0, ‘count’: 0}

    I’ve also tried creating a menu order using the REST API to assign a specific value and then changing the Sort order to Custom but this did nothing either.

    So, not sure if this is a bug or a feature, but if anyone could let me know then that would be great. I’m using WooCommerce V4.3.1

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Damianne P (a11n)

    (@drwpcom)

    Hi @situl. Are you still working on this issue? I did a test on my test site, running WooCommerce 4.5.1 as follows:

    I ordered the attributes how I want them on the site:

    The order of the variations doesn’t matter:

    The sizes show in the order set in the attributes:

    Does that work for you? Please let me know if you have any other questions.

    Plugin Support Damianne P (a11n)

    (@drwpcom)

    Hi @situl. We haven’t heard from you in a while so I’m going to go ahead and mark this thread as resolved. If you still need help with this issue or have any other questions about the WooCommerce plugin, please start a new thread.

    blkpudd

    (@blkpudd)

    Hi,

    I’m jumping on this as having exactly the same issue.

    I have set Attribute Order By to Term ID.

    When I view a product’s variations in the back end, they clearly following the Term ID order correctly. However, on the front end, the select drop down list reverts to Alphabetical and not the Term ID order.

    I have changed themes to all the basic wordpress themes and this has made no difference. I have also removed all other plugins and again, no difference.

    Is the Order By ID supposed to work on the front end?

    Many thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Product Attributes not sorting by Term ID’ is closed to new replies.