Overview
  • Namespace
  • Class

Namespaces

  • None
  • WC_POS
    • Admin
      • Settings
        • Receipt
    • API
    • Gateways
    • Integrations
    • Products

Classes

  • WC_POS\Activator
  • WC_POS\Admin
  • WC_POS\Admin\Gateways
  • WC_POS\Admin\Menu
  • WC_POS\Admin\Notices
  • WC_POS\Admin\Orders
  • WC_POS\Admin\Page
  • WC_POS\Admin\Permalink
  • WC_POS\Admin\Plugins
  • WC_POS\Admin\Products
  • WC_POS\Admin\Settings
  • WC_POS\Admin\Settings\Access
  • WC_POS\Admin\Settings\Checkout
  • WC_POS\Admin\Settings\Customers
  • WC_POS\Admin\Settings\Gateways
  • WC_POS\Admin\Settings\General
  • WC_POS\Admin\Settings\HotKeys
  • WC_POS\Admin\Settings\Page
  • WC_POS\Admin\Settings\Receipt\Options
  • WC_POS\Admin\Settings\Receipt\Template
  • WC_POS\Admin\Settings\Receipts
  • WC_POS\Admin\Settings\Status
  • WC_POS\Admin\Settings\Tools
  • WC_POS\Admin\Status
  • WC_POS\Ajax
  • WC_POS\API
  • WC_POS\API\Coupons
  • WC_POS\API\Customers
  • WC_POS\API\Gateways
  • WC_POS\API\i18n
  • WC_POS\API\Orders
  • WC_POS\API\Params
  • WC_POS\API\Payload
  • WC_POS\API\Products
  • WC_POS\API\Settings
  • WC_POS\API\Support
  • WC_POS\API\Templates
  • WC_POS\Customers
  • WC_POS\Deactivator
  • WC_POS\Gateways
  • WC_POS\Gateways\Card
  • WC_POS\Gateways\Cash
  • WC_POS\i18n
  • WC_POS\Integrations\Bookings
  • WC_POS\Products
  • WC_POS\Products\Visibility
  • WC_POS\Setup
  • WC_POS\Status
  • WC_POS\Tax
  • WC_POS\Template

Functions

  • is_pos
  • is_pos_admin
  • wc_pos_get_option
  • wc_pos_json_encode
  • wc_pos_locate_template
  • wc_pos_trim_html_string
  • wc_pos_update_option
  • wc_pos_url
 1 <?php
 2 /**
 3  * POS Tax Class
 4  *
 5  * @class    WC_POS_Tax
 6  * @package  WooCommerce POS
 7  * @author   Paul Kilmurray <paul@kilbot.com.au>
 8  * @link     http://www.woopos.com.au
 9  */
10 
11 namespace WC_POS;
12 
13 class Tax {
14 
15   /**
16    * Returns all tax classes, class => label
17    * @return array
18    */
19   static public function tax_classes() {
20     $classes = array(
21       /* translators: woocommerce */
22       '' => __( 'Standard', 'woocommerce' )
23     );
24 
25     // get_tax_classes method introduced in WC 2.3
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    * Returns base tax rates for all tax classes
41    * @return array
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 }
API documentation generated by ApiGen