當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WC_Tax::get_tax_location方法代碼示例

本文整理匯總了PHP中WC_Tax::get_tax_location方法的典型用法代碼示例。如果您正苦於以下問題:PHP WC_Tax::get_tax_location方法的具體用法?PHP WC_Tax::get_tax_location怎麽用?PHP WC_Tax::get_tax_location使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WC_Tax的用法示例。


在下文中一共展示了WC_Tax::get_tax_location方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: set_base_tax_rates

 public function set_base_tax_rates($rates, $tax_class)
 {
     $location = WC_Tax::get_tax_location($tax_class);
     if (in_array($tax_class, array('virtual-rate', 'virtual-reduced-rate')) && isset($location[0]) && sizeof($location) === 4 && $location[0] !== WC()->countries->get_base_country()) {
         list($country, $state, $postcode, $city) = $location;
         $rates = WC_Tax::find_rates(array('country' => $country, 'state' => $state, 'postcode' => $postcode, 'city' => $city, 'tax_class' => $tax_class));
     }
     return $rates;
 }
開發者ID:ronzeiller,項目名稱:woocommerce-germanized,代碼行數:9,代碼來源:class-wc-gzd-virtual-vat-helper.php

示例2: test_get_shipping_tax_rates

 /**
  * Get rates.
  */
 public function test_get_shipping_tax_rates()
 {
     global $wpdb;
     $wpdb->query("DELETE FROM {$wpdb->prefix}woocommerce_tax_rates");
     $wpdb->query("DELETE FROM {$wpdb->prefix}woocommerce_tax_rate_locations");
     $customer_location = WC_Tax::get_tax_location();
     $tax_rate = array('tax_rate_country' => $customer_location[0], 'tax_rate_state' => '', 'tax_rate' => '20.0000', 'tax_rate_name' => 'VAT', 'tax_rate_priority' => '1', 'tax_rate_compound' => '0', 'tax_rate_shipping' => '1', 'tax_rate_order' => '1', 'tax_rate_class' => '');
     $tax_rate_id = WC_Tax::_insert_tax_rate($tax_rate);
     $tax_rates = WC_Tax::get_shipping_tax_rates();
     $this->assertEquals($tax_rates, array($tax_rate_id => array('rate' => '20.0000', 'label' => 'VAT', 'shipping' => 'yes', 'compound' => 'no')));
     WC_Tax::_delete_tax_rate($tax_rate_id);
 }
開發者ID:Korkey128k,項目名稱:woocommerce,代碼行數:15,代碼來源:tax.php


注:本文中的WC_Tax::get_tax_location方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。