Product stock based show the discount bar

Implement discount bar based on product stock availability.

add_filter('advanced_woo_discount_rules_advance_table_based_on_rule', function ($advanced_layout, $rule, $discount_calculator, $product, $product_price, $html_content){
    // Check if the product is a variable product
    if ( $product->is_type( 'variable' ) ) {
        // Loop through each variation
        foreach ( $product->get_children() as $variation_id ) {
			
            $variation = wc_get_product( $variation_id );
            if ( ! $variation->is_in_stock() ) {
                $advanced_layout = [];
                break;
            }
        }
    } else {
        // For simple products
        if ( ! $product->is_in_stock() ) {
            $advanced_layout = [];
        }
    }
	
    return $advanced_layout;
},11,6);