【发布时间】:2020-05-27 05:24:11
【问题描述】:
我正在尝试在 Woocommerce 感谢页面上将一些订单详细信息传递给第三方。一切正常——除了获取优惠券 ID。
我错过了什么?我已经通读了this question,但没有过多地阐明主题。
似乎没有很多关于 WC 优惠券的文档...谢谢!
function goodcart_tracking( $order_id ) {
$order = new WC_Order( $order_id );
$order_number = $order->get_id();
$currency = $order->get_order_currency();
$email = $order->get_billing_email();
$total = $order->get_total();
$coupon = $order->get_used_coupons().implode(",",$coupons);
$date = $order->order_date;
?>
<script type="text/javascript">
var params = {
'gc_hash': 'HASH_ID',
'customer_email': '<?php echo $email ?>',
'order_id': '<?php echo $order_number; ?>',
'order_amount': '<?php echo $total; ?>',
'order_amount_type': '<?php echo $currency; ?>',
'promo_code': '<?php echo $coupon; ?>'
};
iGCCpnObj = new _iGCBannerObj(params); iGCCpnObj.start();
</script>
<?php }
【问题讨论】:
标签: php wordpress woocommerce coupon