我在通过代码搜索后发现了一个过滤器。我甚至增加了一些额外的代码来重新排列这些值,以便增值税出现在总额之前。如果你不想这样做,我会发布解决方案,而无需重新排序。我已经添加了10美元的虚拟价格,您可以用您的计算来替换。
function modify_wc_pip_document_table_footer($rows, $type, $order_id) {
$tmp_rows = array();
$tmp_rows['cart_subtotal'] = $rows['cart_subtotal'];
$tmp_rows['payment_method'] = $rows['payment_method'];
$tmp_rows['vat'] = array('vat_total' => '<strong class="order-order_total">VAT Total:</strong>',
'value' => wc_price(10)
);
$tmp_rows['order_total'] = $rows['order_total'];
return $tmp_rows;
}
add_filter('wc_pip_document_table_footer', 'modify_wc_pip_document_table_footer', 10, 3);
没有重新排序
function modify_wc_pip_document_table_footer($rows, $type, $order_id) {
$order = wc_get_order($order_id);
$order_total = $order->get_total();
$rows['vat'] = array('vat_total' => '<strong class="order-order_total">VAT Total:</strong>',
'value' => wc_price(600)
);
return $rows;
}
add_filter('wc_pip_document_table_footer', 'modify_wc_pip_document_table_footer', 10, 3);
这是完美的.....我如何获取订单总额? – Deb
CAn我将订单子总金额更改为[price] /1.2? – Deb
我添加了一些额外的代码,以显示如何从无序重新排序代码中的$ order_id中获得总数。 –