• Skip to main content
  • Skip to primary sidebar

Purely Supplemental Hub

Just The Tech, News, and Info We Deem To Post

  • WordPress
  • Marketing
  • Business
  • Computing
  • Security
  • Publicity
  • Resources
  • WHATEVS

Add Sort Order to WooCommerce Page Attributes

Add the following code to your theme’s function.php file, or a functionality plugin to add Sort Order to WooCommerce Page Attributes.

/** Sort products by menu order ********/

function be_products_query( $query ) {
	if( $query->is_main_query() && !is_admin() && ( is_post_type_archive( 'products' ) || is_tax( array( 'products_category', 'products_tag' ) ) ) ) {
                $query->set( 'posts_per_page', '25' );
		$query->set( 'orderby', 'menu_order' );
		$query->set( 'order', 'ASC' );
	}
}
add_action( 'pre_get_posts', 'be_products_query' );

Filed Under: Code Snippets Tagged With: Page Attributes, WooCommerce

Reader Interactions

Share Your Two Cents Cancel reply

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

Primary Sidebar

© Copyright Jack Alltrade & Associates 2026 · Purely Supplemental™ is a trademark of Jack Alltrade & Associates