Show Products from Parent Category 1st Then Child Category

This code sets the order on a woocommerce product category archive so products from the parent category display first followed by products from child categories.

By default, any products added to child categories can display in any order on the parent category archive like this :

The code in this tutorial orders products so products from the parent category display first followed by products from any child category of the parent like this :

Copy and paste the following code to the end of your child themes functions file or custom code snippets plugin.

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.