WooCommerce Product Bundles compatible with auto add free product

Ensure compatibility of WooCommerce Product Bundles with automatically added free products.

add_action('advanced_woo_discount_rules_after_apply_discount', function (){
    $cart_items = WC()->cart->get_cart();
    if(!empty($cart_items)){
        foreach ($cart_items as $key => $item){
            if(isset($item['bundled_by'])){
                if(isset($cart_items[$item['bundled_by']])){
                    $itemParent = $cart_items[$item['bundled_by']];
                    if(isset($itemParent['data']->is_awdr_free_product) && $itemParent['data']->is_awdr_free_product){
                        $item['data']->set_price(0);
                    }
                }
            }
        }
    }
}, 20);