Categories
protip WooCommerce

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!

7 replies on “Change order of Available Downloads in WooCommerce”

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

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!

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

Leave a Reply