我正试图让这个订单跟踪工作一切都在工作,除了$order_total
<!-- Image Pixel Tracking - Mandatory -->
<img src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=xxxx&amount=<?php echo $order_total ?>&cr=GBP&ref=<?php echo $order_id; ?>&parts=DEFAULT:<?php echo $order_total ?>&vc=<?php echo $order_coupon ?>&ch=AW&testmode=0" border="0" width="0" height="0">
<!-- Javascript Tracking - Mandatory -->
<script type="text/javascript">
//<![CDATA[
/*** Do not change ***/
var AWIN = {};
AWIN.Tracking = {};
AWIN.Tracking.Sale = {};
/*** Set your transaction parameters ***/
AWIN.Tracking.Sale.amount = '<?php echo $order_total; ?>';
AWIN.Tracking.Sale.orderRef = '<?php echo $order_id; ?>';
AWIN.Tracking.Sale.parts = 'DEFAULT:<?php echo $order_total; ?>';
AWIN.Tracking.Sale.voucher = '<?php echo $order_coupon; ?>';
AWIN.Tracking.Sale.currency = 'GBP';
AWIN.Tracking.Sale.test = '0';
AWIN.Tracking.Sale.channel = 'AW';
//]]>
</script>
我得到了订单总额,但我需要它来删除任何折扣和运费,我已经尝试过了
$order_total_without_discount = number_format($order->get_subtotal(), 2, ".", "");
$cart_discount = $woocommerce->cart->discount_total;
$cart_discount_decimal = number_format($cart_discount, 2, ".", "");
$order_total = $order_total_without_discount - $cart_discount_decimal;
$order_total_with_shipping = number_format($order->get_total(), 2, ".", "");
不工作,希望有人能帮助。
我已经回到追踪公司,他们没有提供任何支持。
修改
$order_total_without_discount = number_format($order->get_subtotal(), 2, ".", "");
$order_total_without_discount = number_format($order->get_total(), 2, ".", "");