Anas Mohammad
Forum Replies Created
-
I have the same issue. Looks like there’s no solution yet!
- This reply was modified 6 years, 9 months ago by Anas Mohammad.
Thanks. It did helped me
Forum: Plugins
In reply to: [WooCommerce] Exclude Stock out products from Related productsHi Rynald0s,
I have used the blow code :
`function iconic_enable_hide_out_of_stock_items( $template_name, $template_path, $located, $args ) {
if( $template_name !== “single-product/related.php” ) {
return;
}add_filter( ‘pre_option_woocommerce_hide_out_of_stock_items’, function( $option ) { return “yes”; }, 10, 1 );
}function iconic_disable_hide_out_of_stock_items( $template_name, $template_path, $located, $args ) {
if( $template_name !== “single-product/related.php” ) {
return;
}add_filter( ‘pre_option_woocommerce_hide_out_of_stock_items’, function( $option ) { return “no”; }, 10, 1 );
}add_action( ‘woocommerce_before_template_part’, ‘iconic_enable_hide_out_of_stock_items’, 10, 4 );
add_action( ‘woocommerce_after_template_part’, ‘iconic_disable_hide_out_of_stock_items’, 10, 4 );- This reply was modified 7 years, 9 months ago by Anas Mohammad.