php - Get discounted price within custom plugin from another WooCommerce plugin -


i've developed custom plugin wordpress / woocommerce listing out wishlist of products. 1 thing can't work out how retrieve price processed hooks / filters added other plugins: woocommerce role pricing (light).

i have woocommerce role pricing (light) installed , discounted price based on user role. programmatically discounted price in context of plugin i'm building.

instantiating product via wc_product works single full price only.

ie:

$wooproduct = new wc_product( $val->product_id ); $price = $wooproduct->get_price(); //^^ above price wrong , not discounted. 

in context of i'm building:

// loop on products / populate quantity 0 if no quantity or entry found on existing product. foreach ($products $key => $val) {      $wooproduct = new wc_product( $val->product_id );      $price = $wooproduct->get_price();     //$price wrong here , not discounted role pricing light      $name = $wooproduct->post->post_title;     $id = $wooproduct->post->id;     $url = get_permalink ($id);      $tmpproducts [] = array(         "product_id"=>$val->product_id,         "item_id"=> isset($userorderproducts[$val->product_id]["item_id"]) ? $userorderproducts[$val->product_id]["item_id"] : null,         "title" => $wooproduct->post->post_title,         "url" => get_permalink ($id),         "price" => $wooproduct->get_price(),         "qty" => isset($userorderproducts[$val->product_id]["quantity"]) ? intval($userorderproducts[$val->product_id]["quantity"]) : 0,     ); } 


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -