我需要在Woocommerce订单中获取小计购物车(不含运费)以便在此转换代码中注册
add_action( 'woocommerce_thankyou', 'pixelsoicos' );
function pixelsoicos( $order_id ) {
// Lets grab the order
$order = new WC_Order( $order_id );
$items = $order->get_items();
foreach ( $items as $item );
?>
<script type="text/javascript" src="http://ad.soicos.com/soicosjs.php?s=.js"></script>
<script type="text/javascript">
(function() {
soicos.registerConversion({
pid : 3507,
data : "",
trans : {
orderID : "<?php echo $order_id;?>",
store_name : "brudys",
total : "",
tax : "",
shipping : "<?php echo $order->get_total_shipping();?>",
city : "",
province : "",
country : "",
currency : '<?php echo get_woocommerce_currency();?>'});})();
</script>
<?php
}
答案 0 :(得分:-1)
试
WC()->cart->subtotal
或者
WC()->cart->get_cart_subtotal()