In shop, some products belong to multiple categories. This makes default WooCommerce ordering not working, because if one product is first in category A then other product can't be first in category B if both belong to the same category.
I want to find a way to sort products in shop categories by post id in particular order I want ( I will supply IDs).
So far I came up with:
add_filter( 'woocommerce_get_catalog_ordering_args', 'my_ordering_function', 20, 1 );
function my_ordering_function( $args ) {
$product_category = 'my-category';
if( ! is_product_category($product_category) ) return $args;
$args['post__in'] = array( 74, 116, 3565, 3563 );
$args['orderby'] = 'post__in';
$args['order'] = 'ASC';
return $args;
}
This code should do the job, but after examining woocommerce_get_catalog_ordering_args
source code, it looks like post__in is not even supported.
Any ideas on how to dictate my own product order per category?