Hello,
1) There are warnings on the page https://prnt.sc/11iiexw Maybe vecause of your custom or third-party plugins.
2) Try to replace your line of code with following code https://prnt.sc/11iitmn
4) Try to use the loop_shop_post_in filter
add_filter( 'loop_shop_post_in', array( $this, 'show_on_sale_products' ) );
// define the loop_shop_post_in callback
function custom_loop_shop_post_in( $query ){
//custom code here
return $query;
}
//add the action
add_filter('loop_shop_post_in', 'custom_loop_shop_post_in', 10, 1);
Regards