Viewing 11 replies - 1 through 11 (of 11 total)
  • This is done through Products >> Attributes within wp-admin. It isn’t part of this plugin, but WooCommerce.

    1. Select the Attribute (e.g. Size) to edit.
    2. Then, you’ll noticed an option “Default sort order”. Select the option that you desire.
    3. And Save the changes.

    I’m using WooCommerce 3.0.6.

    Hello Guys,

    I am having the same problem. I wanna order my size from smallest to largest.

    I edited the “Default Sort Order” for “Custom Ordering” but did not find where exactly I should “drag and drop” to organize them. It would be at each product editing page? (I tried no success)

    In addition, I was looking forward to have a size box that could be crossed when the size is not available. Any chance of getting that with this plugin? or maybe any other plugin available ?

    http://sunflowerbikinis.com/product/ki-korpo-flamingo-off-shoulder-top-bottom/

    @sunflowerbikinis

    As I mentioned above, go to Products >> Attributes in backend admin to add your Attribute, such as Size. Then, you can add Small, Medium, and Large. Once saved, return to where the Variables are and click, drag and drop according to the order you want. The order will be automatically saved once you drop it into position.

    As for your second question, I’m really not sure what you’re trying to achieve. Do you mean the product if a particular Size, say Large, is Out-of-Stock, then that option is available for selection? If so, there is a work around for this method. Do let me know if that’s what you wish to achieve so that I may find a workable solution, which you can customise in your active child theme.

    I’m having a simular problem:

    I have 60 variants, where I wanna change the order completely:

    These 60 variants are showen on 4 pages:
    (60 variants (Open / Close) « ‹ 1 of 4 › »)

    I wanna move 8 products from the top, to the end of the complete list.

    Alternativly, I would be happy, if I just could change the order of the options in one of my 3 dropdowns on the fronpage…

    @jeanjensendk agreed. This is sort of hell.

    Hi, I finally found a solution to order the product variations (in my case, alphabetical) in the frontend (combobox). Here is the code:

    add_filter('woocommerce_dropdown_variation_attribute_options_html', function ($html) {
        $xml = simplexml_load_string($html);
    
        $select = array('id'               => (string)$xml->attributes()['id'],
                        'name'             => (string)$xml->attributes()['name'],
                        'attribute_name'   => (string)$xml->attributes()['data-attribute_name'],
                        'show_option_none' => (string)$xml->attributes()['data-show_option_none']);
    
        $options = array();
        foreach($xml->option as $option) {
            $options[] = array('text'     => (string)$option,
                               'value'    => (string)$option->attributes()['value'],
                               'selected' => (string)$option->attributes()['selected'] === 'selected');
        }
    
        usort($options, function ($a, $b) {
            return strcmp($a['value'], $b['value']);
        });
    
        $xml = simplexml_load_string('<select/>');
        $xml->addAttribute("id", $select["id"]);
        $xml->addAttribute("name", $select["name"]);
        $xml->addAttribute("data-attribute_name", $select["attribute_name"]);
        $xml->addAttribute("data-show_option_none", $select["show_option_none"]);
        
        foreach ($options as $option) {
            $child = $xml->addChild('option');
            $child->value = $option['text'];
            $child->addAttribute('value', $option['value']);
            if ($option['selected']) {
                $child->addAttribute('selected', 'selected');
            }
        }
    
        return $xml->asXML();
    });

    Cheers,
    Miguel.

    It would help of woo was not using rules such as alphabetizing and if a number is part of the variation ordering the product variations by them. It would be nice if the importer just took the input in the order it is received and put it in the bucket. I guess we who are designing our sites don’t know how we want the display to be.

    Another way to fix this is to go to the attribute table, adjust the screen options so you can see enough of what you are editing and then drag and drop the attributes into the order you want. This will put them in the same order on the attached products but you will have to go to the product and update to have the rearranged attributes show on the front end. Yes it is a time wasting hell the way it is.

    I forgot to say when the attributes are set to global, the attribute table organization controls the attributes in the front end display. If you have an attribute linked to multiple products. Only one product will be displayed in the order you set the attribute table most likely. Others will have all the common attributes but not in the same order.
    Too bad the product level can’t override the attribute table.
    Global should mean accessible globally and then the product level arrangement control the front end display. But apparently that is too logical.

    • This reply was modified 6 years, 3 months ago by flyfisher842.

    How to stop ordering in woocommerce without select product Variations.

    @eljkmw

    I’m not sure if @sunflowerbikinis is having the same problem I’m having, but what you’re describing does not appear to be working for me. I have the attribute set to custom ordering; I have the variations dragged-and-dropped into the correct order on the editing screen (and have verified that they’re saved and stay in that order if I reload the page), and yet on the front end product page, the items in the dropdown are sorting alphabetically, not in my specified order.

    I was concerned that I may have overridden this setting with a hook in my theme but I verified that’s also not the case. There may still be some conflict I’m missing somewhere with plugins or something, but I can confirm that on the site I’m working on right now, this is not working as intended.

    @atomicdrivex

    I had the same problem. What I did is went and deleted the attribute from the product tab. Then I went into the specific product page and then created new attribute for eg: Size and then in the value I put Small | Medium | Large and saved it to be used for vairations. Then when I used the variations and saved it it perfectly showed me in the order of
    Small
    Medium
    Large

    Hope it helps

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Changing the order of variations’ is closed to new replies.