Give_Payment::add_fee PHP Méthode

add_fee() public méthode

Add a fee to a given payment
Since: 1.5
public add_fee ( array $args, boolean $global = true ) : boolean
$args array Array of arguments for the fee to add
$global boolean
Résultat boolean If the fee was added
    public function add_fee($args, $global = true)
    {
        $default_args = array('label' => '', 'amount' => 0, 'type' => 'fee', 'id' => '', 'price_id' => 0);
        $fee = wp_parse_args($args, $default_args);
        $this->fees[] = $fee;
        $added_fee = $fee;
        $added_fee['action'] = 'add';
        $this->pending['fees'][] = $added_fee;
        reset($this->fees);
        $this->increase_fees($fee['amount']);
        return true;
    }