woocommerce_get_discounted_price
Allow plugins to filter this price like in the legacy cart class.
This is legacy and should probably be deprecated in the future. $item->object is the cart item object. $this->cart is the cart object.
Использование
add_filter( 'woocommerce_get_discounted_price', 'wp_kama_woocommerce_get_discounted_price_filter', 10, 3 ); /** * Function for `woocommerce_get_discounted_price` filter-hook. * * @param $wc_remove_number_precision * @param $object * @param $cart * * @return */ function wp_kama_woocommerce_get_discounted_price_filter( $wc_remove_number_precision, $object, $cart ){ // filter... return $wc_remove_number_precision; }
- $wc_remove_number_precision
- -
- $object
- -
- $cart
- -
Где вызывается хук
woocommerce_get_discounted_price
woocommerce/includes/class-wc-cart-totals.php 675
apply_filters( 'woocommerce_get_discounted_price', wc_remove_number_precision( $item->total ), $item->object, $this->cart )