Change order of Available Downloads in WooCommerce

If you’re running WooCommerce and you sell digital products, here’s how you can change their order.

By default, WooCommerce will order them from Oldest > Newest.  So the first products you ordered go first, and the latest products you ordered go at the bottom.   If it’s a subscription site, where customers continually get new digital downloads, it might be nice to have the latest downloads on top.

The first thing you will need to do is make a copy of the WooCommerce template, into your theme.  You’re probably using a Child Theme, right?

    1. Copy
      woocommerce/templates/order/order-downloads.php

      into

      yourtheme/woocommerce/order/order-downloads.php

      If your theme already has this file there, you can just make your edits there.

    2. Change this line
      <?php foreach ( $downloads as $download ) : ?>

      to this

      <?php foreach ( array_reverse($downloads) as $download ) : ?>
    3. That’s it!  PHP’s array_reverse does all the magic for you.  Now all your Available Downloads will be ordered with the newest on the top.

      Screen Shot 2015-10-19 at 2.00.50 PM
      The order has been changed!

Comments

8 responses to “Change order of Available Downloads in WooCommerce”

  1. Tanmay Avatar

    Hi

    It isn’t working any more
    Is there any new tricks?

    Thanks

    1. Updated the post with new instructions 🙂

  2. Oh my God!
    This saved my life.
    I have been searching this like crazy since a couple of years.

  3. Hey. Fantastic tip, thank you! Any advice on how to get the Downloads tab to show the download filename, not the product name? I have products with different file downloads depending on the variations they choose, but in their downloads they just see the product name, not the file name. All help appreciated! David

  4. Actually, can I add to that last message? How would I list the product name, followed by the download filename (with a line break, ideally), rather than just the product name. Some people order multiple variations from the same product, so it would be useful to keep the product name and append the downloadable filename as well. Thank you!

      1. That’s brilliant. And it works 🙂 Thank you. Can I ask if it’s possible to pull the post title, for the download file, rather than the filename? I’ve realised that the filenames are a bit ugly when they are pulled through, but the post names (for each downloadable file) are neat and clear and and would look a lot better. Any ideas? Perhaps tweak to the code in the file you’ve already suggested? All help gratefully received! David

  5. ikn0wtech Avatar
    ikn0wtech

    I know this is a really old Post. I have some items in the Download list that were entered into WordPress out of order, and I can’t figure out how to correct this? It doesn’t seem to be affected by the Products date, I get the sense its just sorting on the Product ID? If you have a few items that are out of the sequence you want End users to see how can you correct this?

Leave a Reply