Disable the related products shuffle in WooCommerce

Disable the related products shuffle in WooCommerce on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_filter( 'woocommerce_product_related_posts_shuffle', '__return_false' );
add_filter( 'woocommerce_output_related_products_args', 'wc_sort_related_products' );
 
function wc_sort_related_products( $args ) {
   $args['orderby'] = 'id';
   return $args;
}
 
// alternatively, use 'title', 'date', 'modified', 'menu_order' or 'price', see wc_products_array_orderby()

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.