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.

//display "From XXXX" for products having  bulk  rule , we pass 50 items to get correct range
add_filter( 'woocommerce_get_price_html', function ( $price ) {
  global $woocommerce, $product;

  if( empty( $product) OR empty(WC()->customer) ) 
    return $price; 

  $rules = WDP_Functions::get_active_rules_for_product($product->get_id(), $qty = 50, $use_empty_cart = true);
  if( $rules ) {
    $context  = WDP_Frontend::make_wdp_cart_context_from_wc();
    $bulk = $rules[0]->get_bulk_details($context);
    if( $bulk  ) {
      $range = array_pop($bulk['ranges']);
      $price = 'From ' . wc_price( wc_get_price_to_display( $product, array( 'price' => $range['value'] ) ) ) ;
    }  
  }
  return $price;
}, 10, 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
                );