Exclude child items from applying discount for YITH WooCommerce Product Add-ons & Extra Options

Steps to prevent discounts from being applied to child items in the YITH WooCommerce Product Add-ons & Extra Options plugin.

add_filter('advanced_woo_discount_rules_product_price_on_before_calculate_discount', function($product_price, $product, $quantity, $cart_item){
    if(!empty($cart_item) && isset($cart_item['yith_wapo_item_price']) && is_numeric($cart_item['yith_wapo_item_price'])){
             $product_price =  $cart_item['yith_wapo_item_price'];
    }
    return $product_price;
}, 100, 4);