• Hi:

    I have a situation where I need to be able to add attributes to a product in an exact order.

    However I’m finding that woocommerce automatically re-arranges the attributes in alphabetical order inside the product listing itself.

    So, for example, if I enter multiple values for an attribute like this:
    (Multi-color) (Blue) (Red)

    Woocommerce will re-arrange them so that they are in aphabetical order:
    (Blue) (Multi-color) (Red)

    This is a problem for me because I’m using a plugin that will only take the first attribute entered and drops the rest. So if I have a shirt that is Multi-color, the plugin will list the shirt as Blue because it is the first listed term.

    Is there a way to prevent Woocommerce from re-arranging my attributes at the product level?

    Thanks!

    • This topic was modified 8 years, 2 months ago by cactusview.
    • This topic was modified 8 years, 2 months ago by cactusview.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Go to Admin page > Products > Attributes. Presumably “Default sort order” is set to “Name”, set it to “Custom ordering”.

    Thread Starter cactusview

    (@tcvault)

    Thanks Lorro, but I don’t think I’ve explained my situation well.

    I have already set my ordering to Custom ordering but it doesn’t solve the problem.

    Here is the scenario. Imagine I’m listing two sweaters.

    Sweater #1 has a content blend of 70% wool and 30% cashmere. I want the first attribute value listed as Wool because there is a greater content of wool in my item. So my listed attribute values would be [Wool] [Cashmere].

    Sweater #2 has 70% Cashmere and 30% Wool. In this case I’d want Cashmere to be the first listed attribute value. My attribute values should look like this: [Cashmere] [Wool].

    So, in these two cases there is no appropriate custom ordering that would fulfill my request. The only way to do this is to eliminate the re-ordering of attribute values altogether.

    As it is right now both will be re-ordered [Cashmere] [Wool], and so the plugin will send a value of Cashmere for both sweaters since it passes the value in position 1.

    Does that help make more sense of the issue?

    I have another site where my products are displayed, so on the listing site the ordering of attributes does not matter.

    I found this file which seems to control the terms ordering:
    woocommerce/includes/wc-term-functions.php

    If need be, I’m ok commenting out anything that would control the re-ordering for this specific case.

    • This reply was modified 8 years, 2 months ago by cactusview.
    • This reply was modified 8 years, 2 months ago by cactusview.

    Yes, custom ordering allows you to set up any order but from then on it will be the same order for each product, which I can now see is not what you want. It look’s like you want a no-sort option.

    Re-writing parts of wc-term-functions.php with a no-sort option is a bit big a job for a forum answer. Also, I’d be reluctant to go that way because, unlike a template, its not a file that can be protected from being overwritten by woocommerce updates.

    Would setting up two attribute sets help, one custom sorted to have Wool first, the other with Cashmere first?

    Thread Starter cactusview

    (@tcvault)

    Yes I was afraid of that. Unfortunately my site could have thousands of products, so the number of possible combinations would be too large to make custom attribute sets.

    I was hoping it might simply be one small section that could get commented out in the file, but if not and it needs a re-write as you suggest we’ll look into that.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Prevent attributes from auto arranging in alphabetical order’ is closed to new replies.