PPOM for WooCommerce plugin compatibility (apply discount only on base price of product)

Ensure compatibility with the PPOM for WooCommerce plugin (apply discount only on the base price of the product).

// PPOM Product Addon plugin compatibility (apply discount only on base price of product)
// Tested version: 32.0.2
if (!function_exists('advanced_woo_discount_rules_get_ppom_total_addon_price')) {
    function advanced_woo_discount_rules_get_ppom_total_addon_price($cart_item) {
        if (isset($cart_item['data']) && isset($cart_item['ppom']['fields']) && function_exists('ppom_get_field_prices') && function_exists('ppom_price_get_addon_total')) {
            $product_id = $cart_item['data']->get_id();
            $variation_id = isset($cart_item['variation_id']) ? $cart_item['variation_id'] : '';
            $ppom_fields_post = $cart_item['ppom']['fields'];
            $product_quantity = floatval($cart_item['quantity']);
            $ppom_field_prices = ppom_get_field_prices($ppom_fields_post, $product_id, $product_quantity, $variation_id, $cart_item);
            $total_addon_price = ppom_price_get_addon_total($ppom_field_prices);
            return $total_addon_price;
        }
        return 0;
    }

    add_filter('advanced_woo_discount_rules_discounted_price_of_cart_item', function($price, $cart_item, $cart_object, $cart_item_key) {
        if (isset($cart_item['ppom']['fields'])) {
            $total_addon_price = advanced_woo_discount_rules_get_ppom_total_addon_price($cart_item);
            return $price + $total_addon_price;
        }
        return $price;
    }, 10, 4);

    add_filter( 'advanced_woo_discount_rules_cart_strikeout_price_html', function ($price_html, $item_price, $cart_item, $cart_item_key) {
        if(isset($cart_item['ppom']['fields'])) {
            $total_addon_price = advanced_woo_discount_rules_get_ppom_total_addon_price($cart_item);
            if ($total_addon_price > 0) {
                $price_html .= "[+".wc_price($total_addon_price)."]";
            }
        }
        return $price_html;
    }, 10, 4 );
}