WC_Discount class

This commit is contained in:
Mike Jolley 2017-07-20 20:50:09 +01:00
parent e5ec0e66e3
commit 499519eaac
1 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,77 @@
<?php
/**
* A single discount.
*
* Represents a fixed or percent based discount at cart level. Extended by cart
* and order discounts since they share the same logic for things like tax
* calculation.
*
* @author Automattic
* @package WooCommerce/Classes
* @version 3.2.0
* @since 3.2.0
*/
/**
* Discount class.
*/
class WC_Discount {
/**
* Data array, with defaults.
*
* @var array
*/
protected $data = array(
'id' => '',
'discount' => 0,
);
/**
* Coupon ID.
*
* @param string $id
*/
public function set_id( $id ) {
}
/**
* Discount amount - either fixed or percentage.
*
* @param string $amount
*/
public function set_amount( $amount ) {
}
/**
* Amount of discount this has given in total.
*/
public function set_discount_total() {
}
/**
* Array of negative taxes.
*/
public function set_taxes() {
}
/**
* Calculates the amount of negative tax to apply for this discount, since
* discounts are applied before tax.
*
* For percent discounts this is simply a percent of each cart item's tax.
*
* For fixed discounts, the taxes are calculated proportionally so the
* discount is fairly split between items.
*
* @return [type] [description]
*/
public function calculate_negative_taxes() {
}
}