WC_Abstract_Legacy_Order::update_tax PHP Method

update_tax() public method

Note this does not update order totals.
Since: 2.7
public update_tax ( object | integer $item, array $args ) : integer
$item object | integer
$args array
return integer updated order item ID
    public function update_tax($item, $args)
    {
        wc_deprecated_function('WC_Order::update_tax', '2.7', 'Interact with WC_Order_Item_Tax class');
        if (is_numeric($item)) {
            $item = $this->get_item($item);
        }
        if (!is_object($item) || !$item->is_type('tax')) {
            return false;
        }
        if (!$this->get_id()) {
            $this->save();
            // Order must exist
        }
        $item->set_order_id($this->get_id());
        $item->set_props($args);
        $item->save();
        do_action('woocommerce_order_update_tax', $this->get_id(), $item->get_id(), $args);
        return $item->get_id();
    }