Set rate in one go for tax rate items

This commit is contained in:
Mike Jolley 2016-08-22 14:52:03 +01:00
parent fc2e039882
commit e079895c08
1 changed files with 11 additions and 0 deletions

View File

@ -138,6 +138,17 @@ class WC_Order_Item_Tax extends WC_Order_Item {
$this->_data['compound'] = (bool) $value;
}
/**
* Set properties based on passed in tax rate by ID.
* @param int $tax_rate_id
*/
public function set_rate( $tax_rate_id ) {
$this->set_rate_id( $tax_rate_id );
$this->set_rate_code( WC_Tax::get_rate_code( $tax_rate_id ) );
$this->set_label( WC_Tax::get_rate_code( $tax_rate_id ) );
$this->set_compound( WC_Tax::get_rate_code( $tax_rate_id ) );
}
/*
|--------------------------------------------------------------------------
| Getters