Helpers

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.

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.

Skip to toolbar