1
woocomerce에서 세금을내는 방법 은 하나의 제품 주문에 사용됩니까? 그리고 세금 비율 배송비?WooCommerce에서 하나의 제품과 배송을위한 주문에 세금을 사용하십시오.
woocomerce에서 세금을내는 방법 은 하나의 제품 주문에 사용됩니까? 그리고 세금 비율 배송비?WooCommerce에서 하나의 제품과 배송을위한 주문에 세금을 사용하십시오.
당신은 세금 항목 (제품)에 사용되는 데이터 WC_Order_Item_Product
대상과 방법을 통해 얻을 수 있습니다 :
// Get the an occurrence of the WC_Order object (if needed, from a defined $order ID)
$order = wc_get_order($order_id);
// Iterating through WC_Order_Item_Product objects
foreach($order->get_items() as $item_id => $line_item){
## -- Get all protected data in an accessible array -- ##
$item_data = $line_item->get_data(); // Get the Tax data in an array
$item_tax_class = $item_data['tax_class'];
$item_subtotal_tax = $item_data['subtotal_tax'];
$item_total_tax = $item_data['total_tax'];
$item_taxes_array = $item_data['taxes'];
## -- OR Use WC_Order_Item_Tax methods -- ##
$item_tax_class = $line_item->get_tax_class(); // Tax class
$item_subtotal_tax = $line_item->get_subtotal_tax(); // Line item name
$item_total_tax = $line_item->get_total_tax(); // Tax rate code
$item_taxes_array = $line_item->get_taxes(); // Tax detailed Array
}
은 또한 당신이 (운송 등) 세금 데이터를 얻을 수 있습니다 WC_Order_Item_Tax
개체를 통해 및 방법
// Get the an occurrence of the WC_Order object (if needed, from a defined $order ID)
$order = wc_get_order($order_id);
// Iterating through WC_Order_Item_Tax objects
foreach($order->get_items('tax') as $item_id => $item_tax){
## -- Get all protected data in an accessible array -- ##
$tax_data = $item_tax->get_data(); // Get the Tax data in an array
$item_tax_rate_code = $tax_data['rate_code'];
$item_tax_rate_id = $tax_data['rate_id'];
$item_tax_label = $tax_data['label'];
$item_tax_total = $tax_data['tax_total']; // Tax total amount
$item_tax_shipping_total = $tax_data['shipping_tax_total']; // Tax shipping total
## -- OR Use WC_Order_Item_Tax methods -- ##
$item_type = $item_tax->get_type(); // Line item type
$item_name = $item_tax->get_name(); // Line item name
$rate_code = $item_tax->get_rate_code(); // Tax rate code
$tax_rate_label = $item_tax->get_label(); // Tax label
$tax_rate_id = $item_tax->get_rate_id(); // Tax rate ID
$compound = $item_tax->get_compound(); // Tax compound
$tax_amount_total = $item_tax->get_tax_total(); // Tax rate total
$tax_shipping_total = $item_tax->get_shipping_tax_total(); // Tax shipping total
}
@LoicTheAztec이 질문은 전체 세금 세부 정보가 아닌 * 세율 *에 관한 것임을 유의하십시오. 답을 맞추기 위해 제목을 편집하지 마십시오 (단, 일부 정보는 나머지 사람들에게 유용 할 수 있습니다). – Cedric
미안하지만 제 대답이 맞지 않았습니다. 내 실제 답변은 두 번째 코드 스 니펫에서 질문에 대답하는 것입니다 ... – LoicTheAztec