问题
I add one product for e.g “ABC” – price : $10 (including VAT 20%)
So product net price = £8 and tax = £2
In frontend on product detail page i show product price including TAX.($10)
When Customer purchase this product then in woocommerce order generate like this
product price = $8 tax = $2 ------------------- Total = $10 But i want price in admin order detail page like product price : $10(including 20% VAT)
Not want to show VAT separate.
Thanks
回答1:
Try this. Put it in your theme function.php file
//Add price inc VAT column on admin order page
function action_woocommerce_admin_order_item_values( $null, $item, $absint ) {
$val = ($item['type'] == 'line_item' || $item['type'] == 'shipping') ? $item['total'] + $item['total_tax'] : ' ';
$valdecimal = wc_format_decimal( $val, $dp='', $trim_zeros );
?>
<td class="item_fcost" data-sort-value="<?php echo $val; ?>">
<div class="view" style="font-weight: bold; text-align: right; padding-right: 10px;">
<?php if ($val>0) echo '$'; echo $valdecimal;?>
</div>
</td>
<?php
};
add_action( 'woocommerce_admin_order_item_values', 'action_woocommerce_admin_order_item_values', 10, 3 );
function action_woocommerce_admin_order_item_headers( $order ) {
echo '<th class="item_fcost sortable" data-sort="float" style="text-align: right;">Price inc VAT</th>';
};
add_action( 'woocommerce_admin_order_item_headers', 'action_woocommerce_admin_order_item_headers', 10, 3 );
来源:https://stackoverflow.com/questions/46546482/woocommerce-admin-order-detail-page