WC_Tax::get_shop_base_rate PHP Method

get_shop_base_rate() public static method

Alias for get_base_tax_rates().
Deprecation: 2.3
public static get_shop_base_rate ( $tax_class = '' ) : array
return array
    public static function get_shop_base_rate($tax_class = '')
    {
        return self::get_base_tax_rates($tax_class);
    }

Usage Example

コード例 #1
0
ファイル: class-wc-cart.php プロジェクト: shahadat014/geleyi
 /**
  * Get the product row subtotal.
  *
  * Gets the tax etc to avoid rounding issues.
  *
  * When on the checkout (review order), this will get the subtotal based on the customer's tax rate rather than the base rate
  *
  * @params object product
  * @params int quantity
  * @return string formatted price
  */
 public function get_product_subtotal($_product, $quantity)
 {
     global $woocommerce;
     $price = $_product->get_price();
     $taxable = $_product->is_taxable();
     $base_tax_rates = $this->tax->get_shop_base_rate($_product->tax_class);
     $tax_rates = $this->tax->get_rates($_product->get_tax_class());
     // This will get the base rate unless we're on the checkout page
     // Taxable
     if ($taxable) {
         if ($this->tax_display_cart == 'excl') {
             $row_price = $_product->get_price_excluding_tax($quantity);
             $product_subtotal = woocommerce_price($row_price);
             if ($this->prices_include_tax && $this->tax_total > 0) {
                 $product_subtotal .= ' <small class="tax_label">' . $woocommerce->countries->ex_tax_or_vat() . '</small>';
             }
         } else {
             $row_price = $_product->get_price_including_tax($quantity);
             $product_subtotal = woocommerce_price($row_price);
             if (!$this->prices_include_tax && $this->tax_total > 0) {
                 $product_subtotal .= ' <small class="tax_label">' . $woocommerce->countries->inc_tax_or_vat() . '</small>';
             }
         }
         // Non-taxable
     } else {
         $row_price = $price * $quantity;
         $product_subtotal = woocommerce_price($row_price);
     }
     return apply_filters('woocommerce_cart_product_subtotal', $product_subtotal, $_product, $quantity, $this);
 }
All Usage Examples Of WC_Tax::get_shop_base_rate