File "trait-wc-item-totals.php"
Full path: /home/kosmetik/public_html/wp-content/plugins/woocommerce/includes/traits/trait-wc-item-totals.php
File
size: 897 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
use Automattic\WooCommerce\Utilities\NumberUtil;
if (!defined('ABSPATH')) {
exit;
}
trait WC_Item_Totals
{
protected abstract function get_values_for_total($field);
public static function get_rounded_items_total($values)
{
return array_sum(array_map(array(self::class, 'round_item_subtotal'), $values));
}
public static function round_item_subtotal($value)
{
if (!self::round_at_subtotal()) {
$value = NumberUtil::round($value);
}
return $value;
}
protected static function round_at_subtotal()
{
return 'yes' === get_option('woocommerce_tax_round_at_subtotal');
}
protected static function round_line_tax($value, $in_cents = true)
{
if (!self::round_at_subtotal()) {
$value = wc_round_tax_total($value, $in_cents ? 0 : null);
}
return $value;
}
}