1 <?php
2 /**
3 * WooCommerce Shipping Rate Class
4 *
5 * Simple Class for storing rates.
6 *
7 * @class WC_Shipping_Rate
8 * @version 2.0.0
9 * @package WooCommerce/Classes/Shipping
10 * @category Class
11 * @author WooThemes
12 */
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly
16 }
17
18 class WC_Shipping_Rate {
19
20 var $id = '';
21 var $label = '';
22 var $cost = 0;
23 var $taxes = array();
24 var $method_id = '';
25
26 /**
27 * __construct function.
28 *
29 * @access public
30 * @param mixed $id
31 * @param mixed $label
32 * @param mixed $cost
33 * @param mixed $taxes
34 * @return void
35 */
36 public function __construct( $id, $label, $cost, $taxes, $method_id ) {
37 $this->id = $id;
38 $this->label = $label;
39 $this->cost = $cost;
40 $this->taxes = $taxes ? $taxes : array();
41 $this->method_id = $method_id;
42 }
43
44 /**
45 * get_shipping_tax function.
46 *
47 * @access public
48 * @return array
49 */
50 function get_shipping_tax() {
51 $taxes = 0;
52 if ( $this->taxes && sizeof( $this->taxes ) > 0 && ! WC()->customer->is_vat_exempt() ) {
53 $taxes = array_sum( $this->taxes );
54 }
55 return $taxes;
56 }
57 }