change-category-order-in-wordpress-and-woocommerce

Change Category Order in WordPress and WooCommerce

Have you ever tried to change the default order of the category in your WordPress and WooCommerce site? If the answer is yes, then you’ll be surprised to know how easily you can change category order using our effective ways.

Category order has a huge effect on how readers approach your content. However, WordPress, by default, arranges this taxonomy in alphabetical order, which makes the category list look inflexible and meaningless sometimes.

This raises the necessity for you to sort the category in a different and more interesting way in WordPress. In WooCommerce, site owners have the same concern with the product category and try to customize its order.

In this post, we’ll walk you through ways to change the category as well as taxonomy terms order in WordPress and reorder the product category on WooCommerce. Before getting started, let’s get some basics out of the way.

WordPress Category and Taxonomy Terms – A Great Method to Organize Content

To begin with, a taxonomy provides a great solution for web owners to group related posts together and for readers to find related content. Categories and tags are the default taxonomies used for facilitating structuring your content in WordPress. What’s more, taxonomy terms refer to the items in a taxonomy.

For example, there are sports, films, and music included in your site’s category. While the category itself is a taxonomy, sports, film, and music are known as taxonomy terms.

While WordPress handles posts in reverse chronological order, these taxonomy terms are displayed automatically in alphabetical order in the widget and below each post.

Sometimes, you may want to put the important category on the top to let the readers get more exposure to the term you intend to deliver. Depending on your needs, you can choose the suitable method mentioned below to sort out how your categories display to users.

How to Change Category Order in WordPress

Check out 2 main methods to reorder the WordPress category and have them appeared in the way you want on the frontend – using a plugin and adding code.

Method 1: Use Category Order and Taxonomy Terms Order  plugin

Category Order and Taxonomy Terms Order plugin tackles the category sort problem by letting you change the category order without much hassle.
After installing, head to the WordPress Dashboard→ Posts → Taxonomy Order.

categoryorder_plugin

Everything now turns easy since you just drag and drop the listed categories into whichever order you like.

Method 2: Use a quick code snippet

In fact, you can take matters into your own hands by adding code to the category’s core files. This option is more complicated than using a plugin and requires you to have high technical knowledge.

Navigate to your theme’s category.php file and add the following code:

<?php
$categories = get_terms('books_category');
for( $i=0; $i<sizeof($categories); $i++ ){
if ( $categories[$i]->name == 'New Publications' ) :
$latest = array($categories[$i]);
unset($categories[$i]);
endif;
}
if( isset($latest) )
array_splice( $categories, 0, 0, $latest );
?>

WooCommerce Product Category- A Great Way to Declutter Your E-commerce Shop

In WooCommerce, the product category aims to organize your products. You can easily group similar products into this category, making it convenient for customers to scan and find their desired products.

How to change the order of product category in WooCommerce

Your categories will be displayed twice on your websites, in the sidebar, and in the main catalog.

To reorder your categories within your sidebar:

  1. Go to Product Catalogues and navigate Categories tag
  2. At Bulk Action, drag and drop the categories to the order you prefer

categoryorder_sidebar

To change the order of categories in catalogs:

  1. Go to Product Categories and navigate Catalogues tag
  2. Click UPCP Product Catalogue
  3. Scroll down to UPCP Product Catalogue box
  4. Drag and drop your categories to the new order

categoryorder_catalog

categoryorder_catalog1

How to customize the default product sort order on the category page in WooCommerce

Besides the need to change the product category order, you may want to change the order of the products displayed on a single category page. Fortunately, you can set any type of sorting products in the plugin settings in WooCommerce by following these steps:

  1. Select WooCommerce tag → SettingsProducts in WordPress dashboardcategoryorder_productsort1
  2. Open Display options and view the available sorting options:
    Default Sorting (custom + name)
    Popularity (sales)
    Average rating
    Most recent
    Sort by price (ascending)
    Sort by price (descending)

    categoryorder_productsort2
  3. Choose your own desired default product sort order. If you intend to customize the product order, choose a default sorting.
  4. Navigate to Products tab. Click Sort Products. The default sorting has alphabetical order but you are free to change the products’ order in your own way.
    categoryorder_productsorting
  5. Drag and drop products into the order you want for your Shop page

categoryorder_sortproduct

Keep in mind that this sorting method will make a change in the menu order under Product Data → Advanced for each product.
Whenever you want to get back to alphabetical order sorting, you have to reset the menu order of each product to 0. It may take a great deal of time and effort.

On a Final Note

Despite the fact that WordPress doesn’t offer any category changing functionalities, implementing your own solution is easily achievable.

In WordPress, you can either add a custom code snippet to the theme’s category.php file or use the Category Order and Taxonomy Terms Order plugin to drag and drop selected categories into place.

In WooCommerce, it just takes you some simple steps to customize both product category order and product sorting order.

Depending on the sorting order you wish to change, your level of technical expertise, the kind of your site, you can go with any solutions that we’d already covered to change the category order in your WordPress and WooCommerce sites.

If you have any concerns about changing the category order in WordPress and WooCommerce sites, let us know in the comments section below!

Leave a Reply

Your email address will not be published. Required fields are marked *