当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Tax::get_rate_percent方法代码示例

本文整理汇总了PHP中WC_Tax::get_rate_percent方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Tax::get_rate_percent方法的具体用法?PHP WC_Tax::get_rate_percent怎么用?PHP WC_Tax::get_rate_percent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Tax的用法示例。


在下文中一共展示了WC_Tax::get_rate_percent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _e

									<th><?php 
_e('Rate %', 'woocommerce');
?>
</th>
								</tr>
							</thead>
						<?php 
$rates = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates ORDER BY tax_rate_name LIMIT 100");
foreach ($rates as $rate) {
    echo '
									<tr>
										<td><input type="radio" id="add_order_tax_' . absint($rate->tax_rate_id) . '" name="add_order_tax" value="' . absint($rate->tax_rate_id) . '" /></td>
										<td><label for="add_order_tax_' . absint($rate->tax_rate_id) . '">' . WC_Tax::get_rate_label($rate) . '</label></td>
										<td>' . (isset($classes_options[$rate->tax_rate_class]) ? $classes_options[$rate->tax_rate_class] : '-') . '</td>
										<td>' . WC_Tax::get_rate_code($rate) . '</td>
										<td>' . WC_Tax::get_rate_percent($rate) . '</td>
									</tr>
								';
}
?>
						</table>
						<?php 
if (absint($wpdb->get_var("SELECT COUNT(tax_rate_id) FROM {$wpdb->prefix}woocommerce_tax_rates;")) > 100) {
    ?>
							<p>
								<label for="manual_tax_rate_id"><?php 
    _e('Or, enter tax rate ID:', 'woocommerce');
    ?>
</label><br/>
								<input type="number" name="manual_tax_rate_id" id="manual_tax_rate_id" step="1" placeholder="<?php 
    esc_attr_e('Optional', 'woocommerce');
开发者ID:bitoncoin,项目名称:woocommerce,代码行数:31,代码来源:html-order-items.php

示例2: test_get_rate_percent

 /**
  * Test rate percent.
  */
 public function test_get_rate_percent()
 {
     global $wpdb;
     $tax_rate = array('tax_rate_country' => 'GB', 'tax_rate_state' => '', 'tax_rate' => '20.0000', 'tax_rate_name' => 'VAT', 'tax_rate_priority' => '1', 'tax_rate_compound' => '1', 'tax_rate_shipping' => '1', 'tax_rate_order' => '1', 'tax_rate_class' => '');
     $tax_rate_id = WC_Tax::_insert_tax_rate($tax_rate);
     $this->assertEquals(WC_Tax::get_rate_percent($tax_rate_id), '20%');
     WC_Tax::_delete_tax_rate($tax_rate_id);
 }
开发者ID:Korkey128k,项目名称:woocommerce,代码行数:11,代码来源:tax.php

示例3: wc_gzdp_get_tax_label

function wc_gzdp_get_tax_label($rate_id)
{
    return sprintf(__('VAT %s', 'woocommerce-germanized-pro'), WC_Tax::get_rate_percent($rate_id));
}
开发者ID:radscheit,项目名称:unicorn,代码行数:4,代码来源:wc-gzdp-invoice-functions.php

示例4: apply_filters

					'order'   => $order,
					'item_id' => $item_id,
					'item'    => $item,
					'product' => apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item )
				) );
			}
		?>
		<?php do_action( 'woocommerce_order_items_table', $order ); ?>
	</tbody>
	<tfoot>
		<?php	
		global $woocommerce;
		if ( 'itemized' == get_option( 'woocommerce_tax_total_display' ) ) {
		
		foreach ( $order->get_tax_totals() as $code => $tax ) {
			$tax->rate = WC_Tax::get_rate_percent( $tax->rate_id );
			
			if ( ! isset( $tax_array[ 'tax_rate'] ) )
				$tax_array[ 'tax_rate' ] = array( 'tax' => $tax, 'amount' => $tax->amount, 'contains' => array( $tax ) );
			else {
				array_push( $tax_array[ 'tax_rate' ][ 'contains' ], $tax );
				$tax_array[ 'tax_rate' ][ 'amount' ] += $tax->amount;
			}
		}
		//$tax_label='<span class="include_tax">(inkl.&nbsp;'.$tax_array['tax_rate']['tax']->rate.'&nbsp;'..')</span>';
	}	
			
			/*echo '<pre>';
			print_r($order);
			echo '</pre>';
			$coupon=$order->get_used_coupons();
开发者ID:shwetadubey,项目名称:upfit,代码行数:31,代码来源:order-details.php

示例5: order_item_totals

 /**
  * Improve tax display within order totals
  *  
  * @param  array $order_totals 
  * @param  object $order        
  * @return array               
  */
 public function order_item_totals($order_totals, $order)
 {
     // Set to formatted total without displaying tax info behind the price
     $order_totals['order_total']['value'] = $order->get_formatted_order_total();
     // Tax for inclusive prices
     if ('yes' == get_option('woocommerce_calc_taxes') && 'incl' == $order->tax_display_cart) {
         $tax_array = array();
         if ('itemized' == get_option('woocommerce_tax_total_display')) {
             foreach ($order->get_tax_totals() as $code => $tax) {
                 $tax->rate = WC_Tax::get_rate_percent($tax->rate_id);
                 if (!isset($tax_array[$tax->rate])) {
                     $tax_array[$tax->rate] = array('tax' => $tax, 'amount' => $tax->amount, 'contains' => array($tax));
                 } else {
                     array_push($tax_array[$tax->rate]['contains'], $tax);
                     $tax_array[$tax->rate]['amount'] += $tax->amount;
                 }
             }
         } else {
             $base_rate = array_values(WC_Tax::get_shop_base_rate());
             $base_rate = (object) $base_rate[0];
             $base_rate->rate = $base_rate->rate;
             $tax_array[] = array('tax' => $base_rate, 'contains' => array($base_rate), 'amount' => $order->get_total_tax());
         }
         if (!empty($tax_array)) {
             foreach ($tax_array as $tax) {
                 $order_totals['tax_' . $tax['tax']->label] = array('label' => '<span class="tax small tax-label">' . (get_option('woocommerce_tax_total_display') == 'itemized' ? sprintf(__('incl. %s%% VAT', 'woocommerce-germanized'), wc_gzd_format_tax_rate_percentage($tax['tax']->rate)) : __('incl. VAT', 'woocommerce-germanized')) . '</span>', 'value' => '<span class="tax small tax-value">' . wc_price($tax['amount']) . '</span>');
             }
         }
     }
     return $order_totals;
 }
开发者ID:radscheit,项目名称:unicorn,代码行数:38,代码来源:woocommerce-germanized.php

示例6: get_order_item_totals1

function get_order_item_totals1( $tax_display = '' ) {
	if(is_wc_endpoint_url( 'order-received' ))
	{
		
		$order_id=wc_get_order_id_by_order_key( $_GET['key']);
		$order=new WC_Order($order_id);
		/*echo '<pre>';
		print_r($order);
		echo '</pre>';*/
		$coupons=$order->get_used_coupons();
		$coupon_code=$coupons[0];
		$coupon_data=new WC_Coupon($coupon_code);
		$discount = get_post_meta($coupon_data->id,'coupon_amount',true);
		$type = get_post_meta($coupon_data->id,'discount_type',true);
		
		if($type=='percent'){
			$coupon_label=$discount.'&#37; Rabatt';
		}
		else{
			$coupon_label='Rabatt';
		}
		if ( ! $tax_display ) {
			$tax_display = $order->tax_display_cart;
		}
		
		
		if ( 'itemized' == get_option( 'woocommerce_tax_total_display' ) ) {
			
			
			foreach ( $order->get_tax_totals() as $code => $tax ) {
				$tax->rate = WC_Tax::get_rate_percent( $tax->rate_id );
				
				if ( ! isset( $tax_array[ 'tax_rate'] ) )
					$tax_array[ 'tax_rate' ] = array( 'tax' => $tax, 'amount' => $tax->amount, 'contains' => array( $tax ) );
				else {
					array_push( $tax_array[ 'tax_rate' ][ 'contains' ], $tax );
					$tax_array[ 'tax_rate' ][ 'amount' ] += $tax->amount;
				}
			}
			if(isset($tax_array['tax_rate']['tax']->rate))
			$tax_label='<span class="include_tax">(inkl.&nbsp;'.$tax_array['tax_rate']['tax']->rate.'&nbsp;'.$tax_array['tax_rate']['tax']->label.')</span>';
		}
			
		$total_rows = array();
		
		$shippingcost='0 '.get_woocommerce_currency_symbol();
		
		if ( $order->get_total_discount() > 0 ) {
			$total_rows['discount'] = array(
				'label' => __( $coupon_label, 'woocommerce' ),
				'value'	=> '-' . $order->get_discount_to_display( $tax_display )
			);
		}

		
			$total_rows['shipping'] = array(
				'label' => __( 'Versandkosten', 'woocommerce' ),
				'value'	=>$shippingcost
			);
		

		$total_rows['order_total'] = array(
			'label' => __( 'Gesamtsumme '.$tax_label, 'woocommerce' ),
			'value'	=> $order->get_formatted_order_total( $tax_display )
		);

		return $total_rows;
	}
}
开发者ID:shwetadubey,项目名称:upfit,代码行数:69,代码来源:pdf_functions.php


注:本文中的WC_Tax::get_rate_percent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。