We moved these functions to static class  WDP_Functions  (but legacy class WDP_Frontend can be used too).


get_gifted_cart_products()  just returns array of free items (added by our plugin)  as [product_id_1=>qty_1, product_id_2=>qty_2,..]


get_active_rules_for_product( $product_id, $qty = 1, $use_empty_cart = false )  adds  passed product to existing cart (or empty cart)  and returns array of applied rules , each rule is WDP_Rule object.

add_filter( 'woocommerce_get_price_html', function ( $price, $product ) {
	if ( empty( $product ) or empty( WC()->customer ) ) {
		return $price;
	}
	$context = new \ADP\BaseVersion\Includes\Context();
	$rule    = null;
	foreach (
		adp_functions()->getActiveRulesForProduct( $product->get_id(), $qty = 50, $use_empty_cart = true ) as $loopRule
	) {
		// discount table only for 'SingleItem' rule
		if ( $loopRule instanceof \ADP\BaseVersion\Includes\Rule\Structures\SingleItemRule && $loopRule->getProductRangeAdjustmentHandler() ) {
			$rule = $loopRule;
			break;
		}
	}
	if ( ! $rule ) {
		return $price;
	}
	$handler = $rule->getProductRangeAdjustmentHandler();
	$ranges  = $handler->getRanges();
	$range   = array_pop( $ranges );
	if ( ! $range ) {
		return $price;
	}
	$priceProcessor = new \ADP\BaseVersion\Includes\Product\Processor( $context );
	$cartBuilder    = new \ADP\BaseVersion\Includes\Cart\CartBuilder( $context );
	$cart           = $cartBuilder->create( WC()->customer, WC()->session );
	$priceProcessor->withCart( $cart );
	$priceFunctions = new \ADP\BaseVersion\Includes\External\WC\PriceFunctions( $context );
	$processedProd = $priceProcessor->calculateProduct( $product, $range->getFrom() );
	return "From " . $priceFunctions->format( $priceFunctions->getProcProductPriceToDisplay( $processedProd ) );
}, PHP_INT_MAX, 2 );



get_discounted_product_price( $the_product, $qty, $use_empty_cart = true )  adds  passed product to existing cart (or empty cart)  and returns new price for this product.  We return array [min_price,max_price] for variable products.


get_discounted_products_for_cart( $array_of_products, $plain = false ) adds passed products to empty  cart(make cart)  and  returns products  assigned to active rules  (set in section "Filter by Product").

It sounds a bit confusing, but you can use this way to get list of products which should be added to pre-build cart to  get discounts.



WDP_Functions::get_discounted_products_for_cart( 
                    array( // products will be added to empty WC cart to check conditions
                        array( 'product_id' => 93, 'qty' => 1 ),
                        array( 'product_id' => 95, 'qty' => 1 ), // may add 2nd product 
                    ), 
                    true // TRUE - plain array ,  FALSE - split by rules
                );