1 <?php
2 3 4 5 6 7 8 9
10
11 namespace WC_POS;
12
13 class Tax {
14
15 16 17 18
19 static public function tax_classes() {
20 $classes = array(
21
22 '' => __( 'Standard', 'woocommerce' )
23 );
24
25
26 if( method_exists( '\WC_Tax','get_tax_classes' ) ){
27 $labels = \WC_Tax::get_tax_classes();
28 } else {
29 $labels = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) );
30 }
31
32 foreach( $labels as $label ){
33 $classes[ sanitize_title($label) ] = $label;
34 }
35
36 return $classes;
37 }
38
39 40 41 42
43 static public function tax_rates() {
44 $rates = array();
45
46 foreach( self::tax_classes() as $class => $label ) {
47 if( $rate = \WC_Tax::get_base_tax_rates( $class ) ){
48 $rates[$class] = $rate;
49 }
50 }
51
52 return $rates;
53 }
54
55 }