Include individually priced amount compatibility for WooCommerce Product Bundles by WooCommerce

Include individually priced amounts for WooCommerce Product Bundles by WooCommerce.

if (!function_exists('advanced_woo_discount_rules_get_bundle_min_raw_price')) {
    function advanced_woo_discount_rules_get_bundle_min_raw_price($product_price, $product, $quantity, $cart_item, $calculate_discount_from) {
		if (isset($cart_item) && isset($cart_item['data']) && is_object($cart_item['data'])) {
			if (method_exists($cart_item['data'], 'get_min_raw_price')) {
				$product_price = $cart_item['data']->get_min_raw_price();
			}
		}
		
        return $product_price;
    }

    add_filter('advanced_woo_discount_rules_product_original_price_on_before_calculate_discount', 'advanced_woo_discount_rules_get_bundle_min_raw_price', 100, 5);
    add_filter('advanced_woo_discount_rules_product_price_on_before_calculate_discount', 'advanced_woo_discount_rules_get_bundle_min_raw_price', 100, 5);
}

Last updated