WC_Abstract_Order::get_item_total()
Calculate item cost - useful for gateways.
Метод класса: WC_Abstract_Order{}
Хуки из метода
Возвращает
float
.
Использование
$WC_Abstract_Order = new WC_Abstract_Order(); $WC_Abstract_Order->get_item_total( $item, $inc_tax, $round );
- $item(объект) (обязательный)
- Item to get total from.
- $inc_tax(true|false)
- -
По умолчанию: false) - $round(true|false)
- -
По умолчанию: true)
Код WC_Abstract_Order::get_item_total() WC Abstract Order::get item total WC 9.7.1
public function get_item_total( $item, $inc_tax = false, $round = true ) { $total = 0; if ( is_callable( array( $item, 'get_total' ) ) && $item->get_quantity() ) { if ( $inc_tax ) { $total = ( (float) $item->get_total() + (float) $item->get_total_tax() ) / $item->get_quantity(); } else { $total = ( (float) $item->get_total() ) / $item->get_quantity(); } $total = $round ? NumberUtil::round( $total, wc_get_price_decimals() ) : $total; } return apply_filters( 'woocommerce_order_amount_item_total', $total, $this, $item, $inc_tax, $round ); }