forked from woocommerce/woocommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass-wc-shipping-rate.php
54 lines (49 loc) · 1.03 KB
/
class-wc-shipping-rate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* WooCommerce Shipping Rate Class
*
* Simple Class for storing rates.
*
* @class WC_Shipping_Rate
* @version 2.0.0
* @package WooCommerce/Classes/Shipping
* @category Class
* @author WooThemes
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class WC_Shipping_Rate {
var $id = '';
var $label = '';
var $cost = 0;
var $taxes = array();
var $method_id = '';
/**
* __construct function.
*
* @access public
* @param mixed $id
* @param mixed $label
* @param mixed $cost
* @param mixed $taxes
* @return void
*/
public function __construct( $id, $label, $cost, $taxes, $method_id ) {
$this->id = $id;
$this->label = $label;
$this->cost = $cost;
$this->taxes = $taxes ? $taxes : array();
$this->method_id = $method_id;
}
/**
* get_shipping_tax function.
*
* @access public
* @return array
*/
function get_shipping_tax() {
$taxes = 0;
if ( $this->taxes && sizeof( $this->taxes ) > 0 )
$taxes = array_sum( $this->taxes );
return $taxes;
}
}